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

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

Issue 10945004: Make it possible to read a specific number of characters from a string input stream (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 months 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 | « runtime/bin/file_impl.dart ('k') | 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) 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 * Basic input stream which supplies binary data. 6 * Basic input stream which supplies binary data.
7 * 7 *
8 * Input streams are used to read data sequentially from some data 8 * Input streams are used to read data sequentially from some data
9 * source. All input streams are non-blocking. They each have a number 9 * source. All input streams are non-blocking. They each have a number
10 * of read calls which will always return without any IO related 10 * of read calls which will always return without any IO related
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 * lines separated by line termination character sequences. 115 * lines separated by line termination character sequences.
116 */ 116 */
117 interface StringInputStream default _StringInputStream { 117 interface StringInputStream default _StringInputStream {
118 /** 118 /**
119 * Decodes a binary input stream into characters using the specified 119 * Decodes a binary input stream into characters using the specified
120 * encoding. The default encoding is UTF-8 - `Encoding.UTF_8`. 120 * encoding. The default encoding is UTF-8 - `Encoding.UTF_8`.
121 */ 121 */
122 StringInputStream(InputStream input, [Encoding encoding]); 122 StringInputStream(InputStream input, [Encoding encoding]);
123 123
124 /** 124 /**
125 * Reads as many characters as is available from the stream. If no data is 125 * Reads up to [len] characters from the stream. if [len] is not
126 * available null will be returned. 126 * specified reads as many characters as is available from the
127 * stream. If no data is available null will be returned.
127 */ 128 */
128 String read(); 129 String read([int len]);
129 130
130 /** 131 /**
131 * Reads the next line from the stream. The line ending characters 132 * Reads the next line from the stream. The line ending characters
132 * will not be part of the returned string. If a full line is not 133 * will not be part of the returned string. If a full line is not
133 * available null will be returned. 134 * available null will be returned.
134 */ 135 */
135 String readLine(); 136 String readLine();
136 137
137 /** 138 /**
138 * Returns the number of characters available for immediate 139 * Returns the number of characters available for immediate
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 void set onError(void callback(e)); 238 void set onError(void callback(e));
238 } 239 }
239 240
240 241
241 class StreamException implements Exception { 242 class StreamException implements Exception {
242 const StreamException([String this.message = ""]); 243 const StreamException([String this.message = ""]);
243 const StreamException.streamClosed() : message = "Stream closed"; 244 const StreamException.streamClosed() : message = "Stream closed";
244 String toString() => "StreamException: $message"; 245 String toString() => "StreamException: $message";
245 final String message; 246 final String message;
246 } 247 }
OLDNEW
« no previous file with comments | « runtime/bin/file_impl.dart ('k') | runtime/bin/string_stream.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698