Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Side by Side Diff: sdk/lib/io/output_stream.dart

Issue 12313057: Remove old InputStream and OutputStream classes from dart:io. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/io/iolib_sources.gypi ('k') | sdk/lib/io/stdio.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 part of dart.io;
6
7 /**
8 * Output streams are used to write data sequentially to a data
9 * destination e.g. a connected socket or an open file.
10 *
11 * An output stream provides internal buffering of the data written
12 * through all calls to [write] and [writeFrom] if data cannot be
13 * written immediately to the communication channel. The callback set
14 * through [onNoPendingWrites] can be used to to keep the rate of
15 * writing in sync with the rate the system can actually write data to
16 * the underlying communication channel.
17 */
18 abstract class OutputStream {
19 /**
20 * Writes the content of [buffer] to the stream. If [copyBuffer] is
21 * false ownership of the specified buffer is passed to the system
22 * and the caller should not change it afterwards. The default value
23 * for [copyBuffer] is true.
24 *
25 * Returns true if the data could be written to the underlying
26 * communication channel immediately. Otherwise the data is buffered
27 * by the output stream and will be sent as soon as possible.
28 */
29 bool write(List<int> buffer, [bool copyBuffer]);
30
31 /**
32 * Writes [len] bytes from buffer [buffer] starting at offset
33 * [offset] to the output stream. If [offset] is not specified the
34 * default is 0. If [len] is not specified the default is the length
35 * of the buffer minus [offset] (i.e. writing from offset to the end
36 * of the buffer). The system will copy the data to be written so
37 * the caller can safely change [buffer] afterwards.
38 *
39 * Returns true if the data could be written to the underlying
40 * communication channel immediately. Otherwise the data is buffered
41 * by the output stream and will be sent as soon as possible.
42 */
43 bool writeFrom(List<int> buffer, [int offset, int len]);
44
45 /**
46 * Write a string to the stream using the given [encoding].The
47 * default encoding is UTF-8 - [:Encoding.UTF_8:].
48 *
49 * Returns true if the data could be written to the underlying
50 * communication channel immediately. Otherwise the data is buffered
51 * by the output stream and will be sent as soon as possible.
52 */
53 bool writeString(String string, [Encoding encoding]);
54
55 /**
56 * Flushes data from any internal buffers as soon as possible. Note
57 * that the actual meaning of calling [flush] will depend on the
58 * actual type of the underlying communication channel.
59 */
60 void flush();
61
62 /**
63 * Signal that no more data will be written to the output stream. When all
64 * buffered data has been written out to the communication channel, the
65 * channel will be closed and the [onClosed] callback will be called.
66 */
67 void close();
68
69 /**
70 * Close the communication channel immediately ignoring any buffered
71 * data.
72 */
73 void destroy();
74
75 /**
76 * Returns whether the stream has been closed by calling close(). If true, no
77 * more data may be written to the output stream, but there still may be
78 * buffered data that has not been written to the communication channel. The
79 * onClosed handler will only be called once all data has been written out.
80 */
81 bool get closed;
82
83 /**
84 * Sets the handler that gets called when the internal OS buffers
85 * have been flushed. This callback can be used to keep the rate of
86 * writing in sync with the rate the system can write data to the
87 * underlying communication channel.
88 */
89 void set onNoPendingWrites(void callback());
90
91 /**
92 * Sets the handler that gets called when the underlying communication channel
93 * has been closed and all the buffered data has been sent.
94 */
95 void set onClosed(void callback());
96
97 /**
98 * Sets the handler that gets called when the underlying
99 * communication channel gets into some kind of error situation.
100 */
101 void set onError(void callback(e));
102 }
103
OLDNEW
« no previous file with comments | « sdk/lib/io/iolib_sources.gypi ('k') | sdk/lib/io/stdio.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698