| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 * Input streams are used to read data sequentially from some data | 6 * Input streams are used to read data sequentially from some data |
| 7 * source. All input streams are non-blocking. They each have a number | 7 * source. All input streams are non-blocking. They each have a number |
| 8 * of read calls which will always return without any IO related | 8 * of read calls which will always return without any IO related |
| 9 * blocking. If the requested data is not available a read call will | 9 * blocking. If the requested data is not available a read call will |
| 10 * return [:null:]. All input streams have one or more handlers which | 10 * return [:null:]. All input streams have one or more handlers which |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 */ | 89 */ |
| 90 void set errorHandler(void callback()); | 90 void set errorHandler(void callback()); |
| 91 } | 91 } |
| 92 | 92 |
| 93 | 93 |
| 94 /** | 94 /** |
| 95 * A string input stream wraps a basic input stream and supplies | 95 * A string input stream wraps a basic input stream and supplies |
| 96 * string data. This data can be read either as string chunks or as | 96 * string data. This data can be read either as string chunks or as |
| 97 * lines separated by line termination character sequences. | 97 * lines separated by line termination character sequences. |
| 98 */ | 98 */ |
| 99 interface StringInputStream factory _StringInputStream { | 99 interface StringInputStream default _StringInputStream { |
| 100 /** | 100 /** |
| 101 * Decodes a binary input stream into characters using the specified | 101 * Decodes a binary input stream into characters using the specified |
| 102 * encoding. | 102 * encoding. |
| 103 */ | 103 */ |
| 104 StringInputStream(InputStream input, [String encoding]); | 104 StringInputStream(InputStream input, [String encoding]); |
| 105 | 105 |
| 106 /** | 106 /** |
| 107 * Reads as many characters as is available from the stream. If no data is | 107 * Reads as many characters as is available from the stream. If no data is |
| 108 * available null will be returned. | 108 * available null will be returned. |
| 109 */ | 109 */ |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 * communication channel gets into some kind of error situation. | 153 * communication channel gets into some kind of error situation. |
| 154 */ | 154 */ |
| 155 void set errorHandler(void callback()); | 155 void set errorHandler(void callback()); |
| 156 } | 156 } |
| 157 | 157 |
| 158 | 158 |
| 159 /** | 159 /** |
| 160 * A chunked input stream wraps a basic input stream and supplies | 160 * A chunked input stream wraps a basic input stream and supplies |
| 161 * binary data in configurable chunk sizes. | 161 * binary data in configurable chunk sizes. |
| 162 */ | 162 */ |
| 163 interface ChunkedInputStream factory _ChunkedInputStream { | 163 interface ChunkedInputStream default _ChunkedInputStream { |
| 164 /** | 164 /** |
| 165 * Adds buffering to an input stream and provide the ability to read | 165 * Adds buffering to an input stream and provide the ability to read |
| 166 * the data in known size chunks. | 166 * the data in known size chunks. |
| 167 */ | 167 */ |
| 168 ChunkedInputStream(InputStream input, [int chunkSize]); | 168 ChunkedInputStream(InputStream input, [int chunkSize]); |
| 169 | 169 |
| 170 /** | 170 /** |
| 171 * Reads [chunkSize] bytes from the stream. If [chunkSize] bytes are | 171 * Reads [chunkSize] bytes from the stream. If [chunkSize] bytes are |
| 172 * not currently available null is returned. When the stream is | 172 * not currently available null is returned. When the stream is |
| 173 * closed the last call can return with less than [chunkSize] bytes. | 173 * closed the last call can return with less than [chunkSize] bytes. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 void set errorHandler(void callback()); | 210 void set errorHandler(void callback()); |
| 211 } | 211 } |
| 212 | 212 |
| 213 | 213 |
| 214 class StreamException implements Exception { | 214 class StreamException implements Exception { |
| 215 const StreamException([String this.message = ""]); | 215 const StreamException([String this.message = ""]); |
| 216 const StreamException.streamClosed() : message = "Stream closed"; | 216 const StreamException.streamClosed() : message = "Stream closed"; |
| 217 String toString() => "StreamException: $message"; | 217 String toString() => "StreamException: $message"; |
| 218 final String message; | 218 final String message; |
| 219 } | 219 } |
| OLD | NEW |