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 23 matching lines...) Expand all Loading... |
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. |
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 |
| 45 * default encoding is UTF-8 - [:Encoding.UTF_8:]. |
| 46 * |
| 47 * Returns true if the data could be written to the underlying |
| 48 * communication channel immediately. Otherwise the data is buffered |
| 49 * by the output stream and will be sent as soon as possible. |
| 50 */ |
| 51 bool writeString(String string, [Encoding encoding]); |
| 52 |
| 53 /** |
44 * Indicate that all data has been written to the output | 54 * Indicate that all data has been written to the output |
45 * stream. When all data has been written to the communication | 55 * stream. When all data has been written to the communication |
46 * channel it will be closed. | 56 * channel it will be closed. |
47 */ | 57 */ |
48 void close(); | 58 void close(); |
49 | 59 |
50 /** | 60 /** |
51 * Close the communication channel immediately ignoring any buffered | 61 * Close the communication channel immediately ignoring any buffered |
52 * data. | 62 * data. |
53 */ | 63 */ |
(...skipping 14 matching lines...) Expand all Loading... |
68 */ | 78 */ |
69 void set onClosed(void callback()); | 79 void set onClosed(void callback()); |
70 | 80 |
71 /** | 81 /** |
72 * Sets the handler that gets called when the underlying | 82 * Sets the handler that gets called when the underlying |
73 * communication channel gets into some kind of error situation. | 83 * communication channel gets into some kind of error situation. |
74 */ | 84 */ |
75 void set onError(void callback()); | 85 void set onError(void callback()); |
76 } | 86 } |
77 | 87 |
OLD | NEW |