| OLD | NEW |
| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 * Signal that no more data will be written to the output stream. When all |
| 62 * stream. When all data has been written to the communication | 62 * buffered data has been written out to the communication channel, the |
| 63 * channel it will be closed. | 63 * channel will be closed and the [onClosed] callback will be called. |
| 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 has been closed by calling close(). If true, no |
| 75 * more data may be written to the output stream, but there still may be |
| 76 * buffered data that has not been written to the communication channel. The |
| 77 * onClosed handler will only be called once all data has been written out. |
| 78 */ |
| 79 bool get closed(); |
| 80 |
| 81 /** |
| 74 * Sets the handler that gets called when the internal OS buffers | 82 * 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 | 83 * 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 | 84 * writing in sync with the rate the system can write data to the |
| 77 * underlying communication channel. | 85 * underlying communication channel. |
| 78 */ | 86 */ |
| 79 void set onNoPendingWrites(void callback()); | 87 void set onNoPendingWrites(void callback()); |
| 80 | 88 |
| 81 /** | 89 /** |
| 82 * Sets the handler that gets called when the underlying | 90 * Sets the handler that gets called when the underlying communication channel |
| 83 * communication channel has been closed and no more data can be | 91 * has been closed and all the buffered data has been sent. |
| 84 * send. | |
| 85 */ | 92 */ |
| 86 void set onClosed(void callback()); | 93 void set onClosed(void callback()); |
| 87 | 94 |
| 88 /** | 95 /** |
| 89 * Sets the handler that gets called when the underlying | 96 * Sets the handler that gets called when the underlying |
| 90 * communication channel gets into some kind of error situation. | 97 * communication channel gets into some kind of error situation. |
| 91 */ | 98 */ |
| 92 void set onError(void callback(e)); | 99 void set onError(void callback(e)); |
| 93 } | 100 } |
| 94 | 101 |
| OLD | NEW |