Chromium Code Reviews| 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 is read from a given input stream. Such an input stream can | 6 * Input is read from a given input stream. Such an input stream can |
| 7 * be an endpoint, e.g., a socket or a file, or another input stream. | 7 * be an endpoint, e.g., a socket or a file, or another input stream. |
| 8 * Multiple input streams can be chained together to operate collaboratively | 8 * Multiple input streams can be chained together to operate collaboratively |
| 9 * on a given input. | 9 * on a given input. |
| 10 */ | 10 */ |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 void set closeHandler(void callback()); | 108 void set closeHandler(void callback()); |
| 109 | 109 |
| 110 /** | 110 /** |
| 111 * Sets the handler that gets called when the underlying | 111 * Sets the handler that gets called when the underlying |
| 112 * communication channel gets into some kind of error situation. | 112 * communication channel gets into some kind of error situation. |
| 113 */ | 113 */ |
| 114 void set errorHandler(void callback()); | 114 void set errorHandler(void callback()); |
| 115 } | 115 } |
| 116 | 116 |
| 117 | 117 |
| 118 interface ChunkedInputStream factory _ChunkedInputStream { | |
| 119 /** | |
| 120 * Decodes a binary input stream into characters using the specified | |
|
Mads Ager (google)
2011/12/06 14:05:02
This looks like a copied comment. ;-)
Søren Gjesse
2011/12/07 07:58:29
Done.
| |
| 121 * encoding. | |
| 122 */ | |
| 123 ChunkedInputStream(InputStream input, [int chunkSize]); | |
| 124 | |
| 125 /** | |
| 126 * Reads [chunkSize] bytes from the stream. If [chunkSize] bytes are | |
| 127 * not currently available null is returned. When the stream is | |
| 128 * closed the last call can return with less than [chunkSize] bytes. | |
| 129 */ | |
| 130 List<int> read(); | |
| 131 | |
| 132 /** | |
| 133 * Returns whether the stream has been closed. There might still be | |
| 134 * more data to read. | |
| 135 */ | |
| 136 bool get closed(); | |
| 137 | |
| 138 /** | |
| 139 * Returns the chunk size used by this stream. | |
| 140 */ | |
| 141 int get chunkSize(); | |
| 142 | |
| 143 /** | |
| 144 * Sets the chunk size used by this stream. | |
| 145 */ | |
| 146 void set chunkSize(int chunkSize); | |
| 147 | |
| 148 /** | |
| 149 * Sets the handler that gets called when at least [chunkSize] bytes | |
| 150 * of data is available or the underlying stream has been closed and | |
| 151 * there is still unread data. | |
| 152 */ | |
| 153 void set dataHandler(void callback()); | |
| 154 | |
| 155 /** | |
| 156 * Sets the handler that gets called when there will be no more data | |
| 157 * available in the stream. | |
| 158 */ | |
| 159 void set closeHandler(void callback()); | |
| 160 | |
| 161 /** | |
| 162 * Sets the handler that gets called when the underlying | |
| 163 * communication channel gets into some kind of error situation. | |
| 164 */ | |
| 165 void set errorHandler(void callback()); | |
| 166 } | |
| 167 | |
| 168 | |
| 118 class StreamException implements Exception { | 169 class StreamException implements Exception { |
| 119 const StreamException([String this.message = ""]); | 170 const StreamException([String this.message = ""]); |
| 120 String toString() => "StreamException: $message"; | 171 String toString() => "StreamException: $message"; |
| 121 final String message; | 172 final String message; |
| 122 } | 173 } |
| OLD | NEW |