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

Side by Side Diff: runtime/bin/output_stream.dart

Issue 10832188: Add an OutputStream.closed getter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * Output streams are used to write data sequentially to a data 6 * Output streams are used to write data sequentially to a data
7 * destination e.g. a connected socket or an open file. 7 * destination e.g. a connected socket or an open file.
8 * 8 *
9 * An output stream provides internal buffering of the data written 9 * An output stream provides internal buffering of the data written
10 * through all calls to [write] and [writeFrom] if data cannot be 10 * through all calls to [write] and [writeFrom] if data cannot be
(...skipping 18 matching lines...) Expand all
29 /** 29 /**
30 * Writes [len] bytes from buffer [buffer] starting at offset 30 * Writes [len] bytes from buffer [buffer] starting at offset
31 * [offset] to the output stream. If [offset] is not specified the 31 * [offset] to the output stream. If [offset] is not specified the
32 * default is 0. If [len] is not specified the default is the length 32 * default is 0. If [len] is not specified the default is the length
33 * of the buffer minus [offset] (i.e. writing from offset to the end 33 * of the buffer minus [offset] (i.e. writing from offset to the end
34 * of the buffer). The system will copy the data to be written so 34 * of the buffer). The system will copy the data to be written so
35 * the caller can safely change [buffer] afterwards. 35 * the caller can safely change [buffer] afterwards.
36 * 36 *
37 * Returns true if the data could be written to the underlying 37 * Returns true if the data could be written to the underlying
38 * communication channel immediately. Otherwise the data is buffered 38 * communication channel immediately. Otherwise the data is buffered
39 * by the output stream and will be sent as soon as possible. 39 * by the output stream and will be sent as soon as possible.
Bill Hesse 2012/08/08 14:21:11 I think that the write functions should throw an i
40 */ 40 */
41 bool writeFrom(List<int> buffer, [int offset, int len]); 41 bool writeFrom(List<int> buffer, [int offset, int len]);
42 42
43 /** 43 /**
44 * Write a string to the stream using the given [encoding].The 44 * Write a string to the stream using the given [encoding].The
45 * default encoding is UTF-8 - [:Encoding.UTF_8:]. 45 * default encoding is UTF-8 - [:Encoding.UTF_8:].
46 * 46 *
47 * Returns true if the data could be written to the underlying 47 * Returns true if the data could be written to the underlying
48 * communication channel immediately. Otherwise the data is buffered 48 * communication channel immediately. Otherwise the data is buffered
49 * by the output stream and will be sent as soon as possible. 49 * by the output stream and will be sent as soon as possible.
50 */ 50 */
51 bool writeString(String string, [Encoding encoding]); 51 bool writeString(String string, [Encoding encoding]);
52 52
53 /** 53 /**
54 * Flushes data from any internal buffers as soon as possible. Note 54 * Flushes data from any internal buffers as soon as possible. Note
55 * that the actual meaning of calling [flush] will depend on the 55 * that the actual meaning of calling [flush] will depend on the
56 * actual type of the underlying communication channel. 56 * actual type of the underlying communication channel.
57 */ 57 */
58 void flush(); 58 void flush();
59 59
60 /** 60 /**
61 * Indicate that all data has been written to the output 61 * Indicate that all data has been written to the output
Bill Hesse 2012/08/08 14:21:11 "Signal that no more data will be written to the o
nweiz 2012/08/09 19:39:52 Done.
62 * stream. When all data has been written to the communication 62 * stream. When all data has been written to the communication
63 * channel it will be closed. 63 * channel it will be closed.
64 */ 64 */
65 void close(); 65 void close();
66 66
67 /** 67 /**
68 * Close the communication channel immediately ignoring any buffered 68 * Close the communication channel immediately ignoring any buffered
69 * data. 69 * data.
70 */ 70 */
71 void destroy(); 71 void destroy();
72 72
73 /** 73 /**
74 * Returns whether the stream is closed. No more data may be written to a
Bill Hesse 2012/08/08 14:21:11 Returns whether the stream has been closed by call
nweiz 2012/08/09 19:39:52 Done.
75 * closed stream.
76 */
77 bool get closed();
78
79 /**
74 * Sets the handler that gets called when the internal OS buffers 80 * Sets the handler that gets called when the internal OS buffers
75 * have been flushed. This callback can be used to keep the rate of 81 * have been flushed. This callback can be used to keep the rate of
76 * writing in sync with the rate the system can write data to the 82 * writing in sync with the rate the system can write data to the
77 * underlying communication channel. 83 * underlying communication channel.
78 */ 84 */
79 void set onNoPendingWrites(void callback()); 85 void set onNoPendingWrites(void callback());
80 86
81 /** 87 /**
82 * Sets the handler that gets called when the underlying 88 * Sets the handler that gets called when the underlying
83 * communication channel has been closed and no more data can be 89 * communication channel has been closed and no more data can be
Bill Hesse 2012/08/08 14:21:11 has been closed and all the buffered data has been
nweiz 2012/08/09 19:39:52 Done.
84 * send. 90 * send.
85 */ 91 */
86 void set onClosed(void callback()); 92 void set onClosed(void callback());
87 93
88 /** 94 /**
89 * Sets the handler that gets called when the underlying 95 * Sets the handler that gets called when the underlying
90 * communication channel gets into some kind of error situation. 96 * communication channel gets into some kind of error situation.
91 */ 97 */
92 void set onError(void callback(e)); 98 void set onError(void callback(e));
93 } 99 }
94 100
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698