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

Unified Diff: runtime/bin/input_stream.dart

Issue 8318009: Update the streams interfaces (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Starting implementation 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
Index: runtime/bin/input_stream.dart
diff --git a/runtime/bin/input_stream.dart b/runtime/bin/input_stream.dart
index 48320138d136e70f4d746a33113404c3bbb1ee70..1ea961bf918182d84231ba5c53284bcce034a87c 100644
--- a/runtime/bin/input_stream.dart
+++ b/runtime/bin/input_stream.dart
@@ -22,3 +22,66 @@ interface InputStream {
*/
void readUntil(List<int> pattern, void callback(List<int> buffer));
}
+
+
+interface InputStream2 {
+ /**
+ * Reads as much data as is available from the stream. If no data is
+ * available null will be returned.
+ */
+ List<int> read();
+
+ /**
+ * The data handler gets called when data is available.
+ */
+ void set dataHandler(void callback());
+
+ /**
+ * The close handler gets called when the underlying communication
+ * channel is closed and no more data will become available. 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(int error));
+}
+
+
+interface StringInputStream factory _StringInputStream {
+ /**
+ * Decodes a binary input stream into characters using the specified
+ * encoding.
+ */
+ StringInputStream(InputStream2 input, [String encoding]);
+
+ /**
+ * Reads as many characters as is available from the stream. If no data is
+ * available null will be returned.
+ */
+ String read();
+
+ /**
+ * Returns the encoding used to decode the binary data into characters.
+ */
+ String get encoding();
+
+ /**
+ * The data handler gets called when data is available.
+ */
+ void set dataHandler(void callback());
+}
+
+
+class StreamException implements Exception {
+ const StreamException([String this.message = ""]);
+ String toString() => "StreamException: $message";
+
+ /*
+ * Contains the exception message.
+ */
+ final String message;
+}
« no previous file with comments | « runtime/bin/bin.gypi ('k') | runtime/bin/process.dart » ('j') | runtime/bin/process.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698