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

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

Issue 8772008: Add line handler to string stream (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
« no previous file with comments | « no previous file | runtime/bin/string_stream.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 64
65 /** 65 /**
66 * Reads as many characters as is available from the stream. If no data is 66 * Reads as many characters as is available from the stream. If no data is
67 * available null will be returned. 67 * available null will be returned.
68 */ 68 */
69 String read(); 69 String read();
70 70
71 /** 71 /**
72 * Reads the next line from the stream. The line ending characters 72 * Reads the next line from the stream. The line ending characters
73 * will not be part og the returned string. If a full line is not 73 * will not be part og the returned string. If a full line is not
74 * available null will be returned. 74 * available null will be returned. The line break character(s) are
75 * discarded.
75 */ 76 */
76 String readLine(); 77 String readLine();
77 78
78 /** 79 /**
79 * Returns whether the stream has been closed. There might still be 80 * Returns whether the stream has been closed. There might still be
80 * more data to read. 81 * more data to read.
81 */ 82 */
82 bool get closed(); 83 bool get closed();
83 84
84 /** 85 /**
85 * Returns the encoding used to decode the binary data into characters. 86 * Returns the encoding used to decode the binary data into characters.
86 */ 87 */
87 String get encoding(); 88 String get encoding();
88 89
89 /** 90 /**
90 * Sets the handler that gets called when data is available. 91 * Sets the handler that gets called when data is available. The two
92 * handlers [dataHandler} and [lineHandler] are mutually exclusive
93 * and setting one will remove the other.
91 */ 94 */
92 void set dataHandler(void callback()); 95 void set dataHandler(void callback());
93 96
94 /** 97 /**
98 * Sets the handler that gets called when a line is available. The
99 * two handlers [dataHandler} and [lineHandler] are mutually
100 * exclusive and setting one will remove the other.
101 */
102 void set lineHandler(void callback());
103
104 /**
95 * Sets the handler that gets called when there will be no more data 105 * Sets the handler that gets called when there will be no more data
96 * available in the stream. 106 * available in the stream.
97 */ 107 */
98 void set closeHandler(void callback()); 108 void set closeHandler(void callback());
99 109
100 /** 110 /**
101 * Sets the handler that gets called when the underlying 111 * Sets the handler that gets called when the underlying
102 * communication channel gets into some kind of error situation. 112 * communication channel gets into some kind of error situation.
103 */ 113 */
104 void set errorHandler(void callback()); 114 void set errorHandler(void callback());
105 } 115 }
106 116
107 117
108 class StreamException implements Exception { 118 class StreamException implements Exception {
109 const StreamException([String this.message = ""]); 119 const StreamException([String this.message = ""]);
110 String toString() => "StreamException: $message"; 120 String toString() => "StreamException: $message";
111 final String message; 121 final String message;
112 } 122 }
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/string_stream.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698