Index: sdk/lib/convert/converter.dart |
diff --git a/sdk/lib/convert/converter.dart b/sdk/lib/convert/converter.dart |
index 8e7a6f164f9a5b8aae3319d3b58ca15456a53f8d..43106c6a7d5c8050055b7cce665d63970f48e484 100644 |
--- a/sdk/lib/convert/converter.dart |
+++ b/sdk/lib/convert/converter.dart |
@@ -25,6 +25,32 @@ abstract class Converter<S, T> { |
Converter<S, dynamic> fuse(Converter<T, dynamic> other) { |
return new _FusedConverter<S, T, dynamic>(this, other); |
} |
+ |
+ /** |
+ * Starts a chunked conversion. |
+ * |
+ * The returned [ChunkedConversionSink] supports the interface described by |
+ * [inputInterface]. |
+ * |
+ * If the given [sink] supports the methods described by |
+ * [outputInterface] then the chunked conversion can take advantage of |
+ * the additional methods and provide a more efficient conversion. |
+ * |
+ * If [sink] does not support the [outputInterface] it is adapted. If |
+ * necessary, the adapter buffers all chunks and invokes |
+ * `addNonChunked` on [sink]. |
+ */ |
+ ChunkedConversionSink<S, dynamic> startChunkedConversion( |
Søren Gjesse
2013/07/24 09:26:41
How about just calling this something shorter? May
floitsch
2013/07/24 18:31:15
I'm torn...
Will discuss with others to get a feel
|
+ ChunkedConversionSink sink) { |
+ return new _NonChunkedSink<S, T>(this, sink.adaptTo(outputInterface)); |
+ } |
+ |
+ /** Defines the accepted input interface for chunked conversions. */ |
+ ChunkedConversionInterface get inputInterface => |
+ ChunkedConversionSink.INTERFACE; |
+ /** Defines the accepted output interface for chunked conversions. */ |
+ ChunkedConversionInterface get outputInterface => |
+ ChunkedConversionSink.INTERFACE; |
} |
/** |
@@ -39,4 +65,12 @@ class _FusedConverter<S, M, T> extends Converter<S, T> { |
_FusedConverter(this._first, this._second); |
T convert(S input) => _second.convert(_first.convert(input)); |
+ |
+ ChunkedConversionSink<S, dynamic> startChunkedConversion( |
+ ChunkedConversionSink sink) { |
+ return _first.startChunkedConversion(_second.startChunkedConversion(sink)); |
+ } |
+ |
+ ChunkedConversionInterface get inputInterface => _first.inputInterface; |
+ ChunkedConversionInterface get outputInterface => _second.outputInterface; |
} |