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

Unified 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: Refactored InputStream 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 side-by-side diff with in-line comments
Download patch
« runtime/bin/input_stream.dart ('K') | « runtime/bin/input_stream.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/output_stream.dart
diff --git a/runtime/bin/output_stream.dart b/runtime/bin/output_stream.dart
index edcec3ded6b8b9876665131297927813655da8af..db20a167cfaeeb8dbc6ab3416dc973b8fc86ddb9 100644
--- a/runtime/bin/output_stream.dart
+++ b/runtime/bin/output_stream.dart
@@ -10,10 +10,56 @@
*/
interface OutputStream {
/**
- * Writes [len] bytes into [buffer] buffer starting at [offset] offset].
- * If write succeedes true is returned. Otherwise false is returned
- * and [callback] callback is invoked on completion.
+ * Writes [len] bytes from buffer [buffer] starting at offset [offset].
+ * When write is finished the specified callback is called.
*/
- bool write(List<int> buffer, int offset, int len, void callback());
+ void WriteFully(List<int> buffer, int offset, int len, void callback())
sra1 2011/10/18 23:45:51 Why is this WriteFully, not writeFully? Is this a
Søren Gjesse 2011/10/19 14:45:41 No, that is a mistake.
+
+ /**
+ * Writes up til [len] bytes from buffer [buffer] starting at offset
sra1 2011/10/18 23:45:51 'up til' --> 'up to'
+ * [offset]. Returns the number of bytes written. If all data could not be
+ * written the specified callback is called when more data can be written.
sra1 2011/10/18 23:45:51 When the callback is called, has the data been wri
+ */
+ int write(List<int> buffer, int offset, int len, void callback());
+
+ /**
+ * Close the stream. This will normally also close the underlying
+ * communication channel.
+ */
+ void close();
+
+ /**
+ * The close handler gets called when the underlying communication
+ * channel gets closed. Not all types of communication channels will
+ * emit close events.
+ */
+ void set closeHandler(void callback());
+
+ /**
+ * The error handler gets called when the underlying communication
+ * channel gets into some kind of error situation.
+ */
+ void set errorHandler(void callback(StreamError error));
+}
+
+interface StringOutputStream {
+ /**
+ * Writes [len] bytes from buffer [buffer] starting at offset [offset].
+ * When write is finished the specified callback is called.
+ */
+ void WriteFully(String data, int offset, int len, void callback())
+
+ /**
+ * Writes up til [len] bytes from buffer [buffer] starting at offset
+ * [offset]. Returns the number of bytes written. If all data could not be
+ * written the specified callback is called when more data can be written.
+ */
+ int write(String data, int offset, int len, void callback());
+
+ /**
+ * Sets the encoding to be used when writing string data to the
+ * stream. The default encoding is UTF-8.
+ */
+ void set encoding(String encoding);
}
« 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