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

Unified Diff: sdk/lib/convert/json.dart

Issue 203603008: Introduce class Sink<T>. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 6 years, 9 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 | « sdk/lib/convert/html_escape.dart ('k') | sdk/lib/convert/latin1.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/convert/json.dart
diff --git a/sdk/lib/convert/json.dart b/sdk/lib/convert/json.dart
index db5659c45ef5c10c8f9bb7ad6ff33006c7299bf5..6c6f75e7db59a2d5f1fe94ea4dcf88240d334290 100644
--- a/sdk/lib/convert/json.dart
+++ b/sdk/lib/convert/json.dart
@@ -213,8 +213,7 @@ class JsonEncoder extends Converter<Object, String> {
* Returns a chunked-conversion sink that accepts at most one object. It is
* an error to invoke `add` more than once on the returned sink.
*/
- ChunkedConversionSink<Object> startChunkedConversion(
- ChunkedConversionSink<String> sink) {
+ ChunkedConversionSink<Object> startChunkedConversion(Sink<String> sink) {
if (sink is! StringConversionSink) {
sink = new StringConversionSink.from(sink);
}
@@ -292,8 +291,7 @@ class JsonDecoder extends Converter<String, Object> {
*
* The output [sink] receives exactly one decoded element through `add`.
*/
- StringConversionSink startChunkedConversion(
- ChunkedConversionSink<Object> sink) {
+ StringConversionSink startChunkedConversion(Sink<Object> sink) {
return new _JsonDecoderSink(_reviver, sink);
}
@@ -310,9 +308,9 @@ class JsonDecoder extends Converter<String, Object> {
// TODO(floitsch): don't accumulate everything before starting to decode.
class _JsonDecoderSink extends _StringSinkConversionSink {
final _Reviver _reviver;
- final ChunkedConversionSink<Object> _chunkedSink;
+ final Sink<Object> _sink;
- _JsonDecoderSink(this._reviver, this._chunkedSink)
+ _JsonDecoderSink(this._reviver, this._sink)
: super(new StringBuffer());
void close() {
@@ -321,8 +319,8 @@ class _JsonDecoderSink extends _StringSinkConversionSink {
String accumulated = buffer.toString();
buffer.clear();
Object decoded = _parseJson(accumulated, _reviver);
- _chunkedSink.add(decoded);
- _chunkedSink.close();
+ _sink.add(decoded);
+ _sink.close();
}
}
« no previous file with comments | « sdk/lib/convert/html_escape.dart ('k') | sdk/lib/convert/latin1.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698