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

Unified Diff: runtime/bin/input_stream.dart

Issue 10938010: Switch from interfaces to abstract classes in dart:io. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments. Add test binaries. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/http_impl.dart ('k') | runtime/bin/list_stream.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/input_stream.dart
diff --git a/runtime/bin/input_stream.dart b/runtime/bin/input_stream.dart
index e2e57fcec92270afdff90d2cd60ccad0851247ac..755f54e68a2ad2ffa13ee79a896bfa4fb0cff436 100644
--- a/runtime/bin/input_stream.dart
+++ b/runtime/bin/input_stream.dart
@@ -31,7 +31,7 @@
* Always set up appropriate handlers when using input streams.
*
*/
-interface InputStream {
+abstract class InputStream {
/**
* Reads data from the stream. Returns a system allocated buffer
* with up to [len] bytes. If no value is passed for [len] all
@@ -58,10 +58,9 @@ interface InputStream {
* stream [output]. The default behavior is to close the output when
* all the data from the input stream have been written. Specifying
* `false` for the optional argument [close] keeps the output
- * stream open after writing all data from the input stream. The
- * default value for [close] is `true`.
+ * stream open after writing all data from the input stream.
*/
- void pipe(OutputStream output, [bool close]);
+ void pipe(OutputStream output, [bool close = true]);
/**
* Close the underlying communication channel to avoid getting any
@@ -114,12 +113,15 @@ class Encoding {
* string data. This data can be read either as string chunks or as
* lines separated by line termination character sequences.
*/
-interface StringInputStream default _StringInputStream {
+abstract class StringInputStream {
/**
* Decodes a binary input stream into characters using the specified
- * encoding. The default encoding is UTF-8 - `Encoding.UTF_8`.
+ * encoding.
*/
- StringInputStream(InputStream input, [Encoding encoding]);
+ factory StringInputStream(InputStream input,
+ [Encoding encoding = Encoding.UTF_8]) {
+ return new _StringInputStream(input, encoding);
+ }
/**
* Reads up to [len] characters from the stream. if [len] is not
@@ -188,12 +190,14 @@ interface StringInputStream default _StringInputStream {
* A chunked input stream wraps a basic input stream and supplies
* binary data in configurable chunk sizes.
*/
-interface ChunkedInputStream default _ChunkedInputStream {
+abstract class ChunkedInputStream {
/**
* Adds buffering to an input stream and provide the ability to read
* the data in known size chunks.
*/
- ChunkedInputStream(InputStream input, [int chunkSize]);
+ factory ChunkedInputStream(InputStream input, [int chunkSize = 0]) {
+ return new _ChunkedInputStream(input, chunkSize);
+ }
/**
* Reads [chunkSize] bytes from the stream. If [chunkSize] bytes are
« no previous file with comments | « runtime/bin/http_impl.dart ('k') | runtime/bin/list_stream.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698