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

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

Issue 8318009: Update the streams interfaces (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years, 2 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
« runtime/bin/input_stream.dart ('K') | « runtime/bin/input_stream.dart ('k') | 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) 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 * Output is written to a given output stream. Such an output stream can 6 * Output is written to a given output stream. Such an output stream can
7 * be an endpoint, e.g., a socket or a file, or another output stream. 7 * be an endpoint, e.g., a socket or a file, or another output stream.
8 * Multiple output streams can be chained together to operate collaboratively 8 * Multiple output streams can be chained together to operate collaboratively
9 * on a given output. 9 * on a given output.
10 */ 10 */
11 interface OutputStream { 11 interface OutputStream {
12 /** 12 /**
13 * Writes [len] bytes into [buffer] buffer starting at [offset] offset]. 13 * Writes [len] bytes from buffer [buffer] starting at offset [offset].
14 * If write succeedes true is returned. Otherwise false is returned 14 * When write is finished the specified callback is called.
15 * and [callback] callback is invoked on completion.
16 */ 15 */
17 bool write(List<int> buffer, int offset, int len, void callback()); 16 void WriteFully(List<int> buffer, int offset, int len, void callback())
dcarlson 2011/10/17 21:05:20 offset, len, and callback optional?
dcarlson 2011/10/17 21:05:20 Naming question same as InputStream.
dcarlson 2011/10/17 21:05:20 The use of the callback does seem to share the sem
rchandia 2011/10/17 21:53:46 WriteFully -> writeFully
17
18 /**
19 * Writes up til [len] bytes from buffer [buffer] starting at offset
20 * [offset]. Returns the number of bytes written. If all data could not be
21 * written the specified callback is called when more data can be written.
22 */
23 int write(List<int> buffer, int offset, int len, void callback());
24
25 /**
26 * Close the stream. This will normally also close the underlying
27 * communication channel.
28 */
29 void close();
30
31 /**
32 * The close handler gets called when the underlying communication
33 * channel gets closed. Not all types of communication channels will
34 * emit close events.
35 */
36 void set closeHandler(void callback());
37
38 /**
39 * The error handler gets called when the underlying communication
40 * channel gets into some kind of error situation.
41 */
42 void set errorHandler(void callback(StreamError error));
18 } 43 }
19 44
45 interface StringOutputStream {
46 /**
47 * Writes [len] bytes from buffer [buffer] starting at offset [offset].
48 * When write is finished the specified callback is called.
49 */
50 void WriteFully(String data, int offset, int len, void callback())
rchandia 2011/10/17 21:53:46 writeFully
51
52 /**
53 * Writes up til [len] bytes from buffer [buffer] starting at offset
54 * [offset]. Returns the number of bytes written. If all data could not be
55 * written the specified callback is called when more data can be written.
56 */
57 int write(String data, int offset, int len, void callback());
58
59 /**
60 * Sets the encoding to be used when writing string data to the
61 * stream. The default encoding is UTF-8.
62 */
63 void set encoding(String encoding);
dcarlson 2011/10/17 21:05:20 Getter? same as StringInputStream.
64 }
65
OLDNEW
« runtime/bin/input_stream.dart ('K') | « runtime/bin/input_stream.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698