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

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

Issue 9029001: Add close to input stream and cleanup socket and streams (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years 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) 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 * Pipe the content of this input stream directly to the output 60 * Pipe the content of this input stream directly to the output
61 * stream [output]. The default behavior is to close the output when 61 * stream [output]. The default behavior is to close the output when
62 * all the data from the input stream have been written. Specifying 62 * all the data from the input stream have been written. Specifying
63 * [:false:] for the optional argument [close] keeps the output 63 * [:false:] for the optional argument [close] keeps the output
64 * stream open after writing all data from the input stream. The 64 * stream open after writing all data from the input stream. The
65 * default value for [close] is [:true:]. 65 * default value for [close] is [:true:].
66 */ 66 */
67 void pipe(OutputStream output, [bool close]); 67 void pipe(OutputStream output, [bool close]);
68 68
69 /** 69 /**
70 * Close the underlying communication channel to avoid getting any
71 * more data. In normal situations where all data is read from the
Mads Ager (google) 2011/12/23 08:35:40 A couple of commas would help me read this: In no
Søren Gjesse 2012/01/02 11:51:17 Done.
72 * stream until the close handler is called calling [close] is not
73 * required. When [close] is used the close handler will still be
74 * called.
75 */
76 void close();
77
78 /**
70 * Returns whether the stream is closed. There will be no more data 79 * Returns whether the stream is closed. There will be no more data
71 * to read. 80 * to read.
72 */ 81 */
73 bool get closed(); 82 bool get closed();
74 83
75 /** 84 /**
76 * Sets the handler that gets called when data is available. 85 * Sets the handler that gets called when data is available.
77 */ 86 */
78 void set dataHandler(void callback()); 87 void set dataHandler(void callback());
79 88
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 void set errorHandler(void callback()); 219 void set errorHandler(void callback());
211 } 220 }
212 221
213 222
214 class StreamException implements Exception { 223 class StreamException implements Exception {
215 const StreamException([String this.message = ""]); 224 const StreamException([String this.message = ""]);
216 const StreamException.streamClosed() : message = "Stream closed"; 225 const StreamException.streamClosed() : message = "Stream closed";
217 String toString() => "StreamException: $message"; 226 String toString() => "StreamException: $message";
218 final String message; 227 final String message;
219 } 228 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698