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

Side by Side Diff: sdk/lib/io/io_sink.dart

Issue 18081002: Document that IOSink.add may buffer data. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 | « no previous file | no next file » | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 part of dart.io; 5 part of dart.io;
6 6
7 /** 7 /**
8 * Helper class to wrap a [StreamConsumer<List<int>>] and provide 8 * Helper class to wrap a [StreamConsumer<List<int>>] and provide
9 * utility functions for writing to the StreamConsumer directly. The 9 * utility functions for writing to the StreamConsumer directly. The
10 * [IOSink] buffers the input given by all [StringSink] methods and will delay 10 * [IOSink] buffers the input given by all [StringSink] methods and will delay
11 * a [addStream] until the buffer is flushed. 11 * a [addStream] until the buffer is flushed.
12 * 12 *
13 * When the [IOSink] is bound to a stream (through [addStream]) any call 13 * When the [IOSink] is bound to a stream (through [addStream]) any call
14 * to the [IOSink] will throw a [StateError]. When the [addStream] compeltes, 14 * to the [IOSink] will throw a [StateError]. When the [addStream] compeltes,
15 * the [IOSink] will again be open for all calls. 15 * the [IOSink] will again be open for all calls.
16 */ 16 */
17 abstract class IOSink implements StreamSink<List<int>>, StringSink { 17 abstract class IOSink implements StreamSink<List<int>>, StringSink {
18 factory IOSink(StreamConsumer<List<int>> target, 18 factory IOSink(StreamConsumer<List<int>> target,
19 {Encoding encoding: Encoding.UTF_8}) 19 {Encoding encoding: Encoding.UTF_8})
20 => new _IOSinkImpl(target, encoding); 20 => new _IOSinkImpl(target, encoding);
21 21
22 /** 22 /**
23 * The [Encoding] used when writing strings. Depending on the 23 * The [Encoding] used when writing strings. Depending on the
24 * underlying consumer this property might be mutable. 24 * underlying consumer this property might be mutable.
25 */ 25 */
26 Encoding encoding; 26 Encoding encoding;
27 27
28 /** 28 /**
29 * Writes the bytes uninterpreted to the consumer. 29 * Writes the bytes uninterpreted to the consumer. While the call is
30 * synchronous, the data may be buffered until the underlying resource is
31 * ready. The data should not be modified after a call to [add].
30 */ 32 */
31 void add(List<int> data); 33 void add(List<int> data);
32 34
33 /** 35 /**
34 * Writes an error to the consumer. 36 * Writes an error to the consumer.
35 */ 37 */
36 void addError(error); 38 void addError(error);
37 39
38 /** 40 /**
39 * Adds all elements of the given [stream] to `this`. 41 * Adds all elements of the given [stream] to `this`.
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 218
217 void writeln([Object obj = ""]) { 219 void writeln([Object obj = ""]) {
218 write(obj); 220 write(obj);
219 write("\n"); 221 write("\n");
220 } 222 }
221 223
222 void writeCharCode(int charCode) { 224 void writeCharCode(int charCode) {
223 write(new String.fromCharCode(charCode)); 225 write(new String.fromCharCode(charCode));
224 } 226 }
225 } 227 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698