OLD | NEW |
1 part of dart.convert; | 1 part of dart.convert; |
2 abstract class StringConversionSink extends ChunkedConversionSink<String> {Stri
ngConversionSink(); | 2 abstract class StringConversionSink extends ChunkedConversionSink<String> {Stri
ngConversionSink(); |
3 factory StringConversionSink.withCallback(void callback(String accumulated)) =
_StringCallbackSink; | 3 factory StringConversionSink.withCallback(void callback(String accumulated)) =
_StringCallbackSink; |
4 factory StringConversionSink.from(Sink<String> sink) = _StringAdapterSink; | 4 factory StringConversionSink.from(Sink<String> sink) = _StringAdapterSink; |
5 factory StringConversionSink.fromStringSink(StringSink sink) = _StringSinkConve
rsionSink; | 5 factory StringConversionSink.fromStringSink(StringSink sink) = _StringSinkConve
rsionSink; |
6 void addSlice(String chunk, int start, int end, bool isLast); | 6 void addSlice(String chunk, int start, int end, bool isLast); |
7 ByteConversionSink asUtf8Sink(bool allowMalformed); | 7 ByteConversionSink asUtf8Sink(bool allowMalformed); |
8 ClosableStringSink asStringSink(); | 8 ClosableStringSink asStringSink(); |
9 } | 9 } |
10 abstract class ClosableStringSink extends StringSink {factory ClosableStringSin
k.fromStringSink(StringSink sink, void onClose()) = _ClosableStringSink; | 10 abstract class ClosableStringSink extends StringSink {factory ClosableStringSin
k.fromStringSink(StringSink sink, void onClose()) = _ClosableStringSink; |
(...skipping 28 matching lines...) Expand all Loading... |
39 } | 39 } |
40 void writeln([Object o = ""]) { | 40 void writeln([Object o = ""]) { |
41 _buffer.writeln(o); | 41 _buffer.writeln(o); |
42 if (_buffer.length > _MIN_STRING_SIZE) _flush(); | 42 if (_buffer.length > _MIN_STRING_SIZE) _flush(); |
43 } | 43 } |
44 void writeAll(Iterable objects, [String separator = ""]) { | 44 void writeAll(Iterable objects, [String separator = ""]) { |
45 if (_buffer.isNotEmpty) _flush(); | 45 if (_buffer.isNotEmpty) _flush(); |
46 Iterator iterator = objects.iterator; | 46 Iterator iterator = objects.iterator; |
47 if (!iterator.moveNext()) return; if (separator.isEmpty) { | 47 if (!iterator.moveNext()) return; if (separator.isEmpty) { |
48 do { | 48 do { |
49 _chunkedSink.add(((__x30) => DDC$RT.cast(__x30, dynamic, String, "CastGeneral",
"""line 147, column 26 of dart:convert/string_conversion.dart: """, __x30 is Str
ing, true))(iterator.current.toString())); | 49 _chunkedSink.add(((__x30) => DEVC$RT.cast(__x30, dynamic, String, "CastGeneral",
"""line 147, column 26 of dart:convert/string_conversion.dart: """, __x30 is St
ring, true))(iterator.current.toString())); |
50 } | 50 } |
51 while (iterator.moveNext());} | 51 while (iterator.moveNext());} |
52 else { | 52 else { |
53 _chunkedSink.add(((__x31) => DDC$RT.cast(__x31, dynamic, String, "CastGeneral",
"""line 150, column 24 of dart:convert/string_conversion.dart: """, __x31 is Str
ing, true))(iterator.current.toString())); | 53 _chunkedSink.add(((__x31) => DEVC$RT.cast(__x31, dynamic, String, "CastGeneral",
"""line 150, column 24 of dart:convert/string_conversion.dart: """, __x31 is St
ring, true))(iterator.current.toString())); |
54 while (iterator.moveNext()) { | 54 while (iterator.moveNext()) { |
55 write(separator); | 55 write(separator); |
56 _chunkedSink.add(((__x32) => DDC$RT.cast(__x32, dynamic, String, "CastGeneral",
"""line 153, column 26 of dart:convert/string_conversion.dart: """, __x32 is St
ring, true))(iterator.current.toString())); | 56 _chunkedSink.add(((__x32) => DEVC$RT.cast(__x32, dynamic, String, "CastGeneral"
, """line 153, column 26 of dart:convert/string_conversion.dart: """, __x32 is S
tring, true))(iterator.current.toString())); |
57 } | 57 } |
58 } | 58 } |
59 } | 59 } |
60 void _flush() { | 60 void _flush() { |
61 String accumulated = _buffer.toString(); | 61 String accumulated = _buffer.toString(); |
62 _buffer.clear(); | 62 _buffer.clear(); |
63 _chunkedSink.add(accumulated); | 63 _chunkedSink.add(accumulated); |
64 } | 64 } |
65 } | 65 } |
66 abstract class StringConversionSinkBase extends StringConversionSinkMixin {} | 66 abstract class StringConversionSinkBase extends StringConversionSinkMixin {} |
(...skipping 26 matching lines...) Expand all Loading... |
93 ByteConversionSink asUtf8Sink(bool allowMalformed) { | 93 ByteConversionSink asUtf8Sink(bool allowMalformed) { |
94 return new _Utf8StringSinkAdapter(this, _stringSink, allowMalformed); | 94 return new _Utf8StringSinkAdapter(this, _stringSink, allowMalformed); |
95 } | 95 } |
96 ClosableStringSink asStringSink() { | 96 ClosableStringSink asStringSink() { |
97 return new ClosableStringSink.fromStringSink(_stringSink, this.close); | 97 return new ClosableStringSink.fromStringSink(_stringSink, this.close); |
98 } | 98 } |
99 } | 99 } |
100 class _StringCallbackSink extends _StringSinkConversionSink {final _ChunkedConv
ersionCallback<String> _callback; | 100 class _StringCallbackSink extends _StringSinkConversionSink {final _ChunkedConv
ersionCallback<String> _callback; |
101 _StringCallbackSink(this._callback) : super(new StringBuffer()); | 101 _StringCallbackSink(this._callback) : super(new StringBuffer()); |
102 void close() { | 102 void close() { |
103 StringBuffer buffer = DDC$RT.cast(_stringSink, StringSink, StringBuffer, "CastGe
neral", """line 233, column 27 of dart:convert/string_conversion.dart: """, _str
ingSink is StringBuffer, true); | 103 StringBuffer buffer = DEVC$RT.cast(_stringSink, StringSink, StringBuffer, "CastG
eneral", """line 233, column 27 of dart:convert/string_conversion.dart: """, _st
ringSink is StringBuffer, true); |
104 String accumulated = buffer.toString(); | 104 String accumulated = buffer.toString(); |
105 buffer.clear(); | 105 buffer.clear(); |
106 _callback(accumulated); | 106 _callback(accumulated); |
107 } | 107 } |
108 ByteConversionSink asUtf8Sink(bool allowMalformed) { | 108 ByteConversionSink asUtf8Sink(bool allowMalformed) { |
109 return new _Utf8StringSinkAdapter(this, _stringSink, allowMalformed); | 109 return new _Utf8StringSinkAdapter(this, _stringSink, allowMalformed); |
110 } | 110 } |
111 } | 111 } |
112 class _StringAdapterSink extends StringConversionSinkBase {final Sink<String> _
sink; | 112 class _StringAdapterSink extends StringConversionSinkBase {final Sink<String> _
sink; |
113 _StringAdapterSink(this._sink); | 113 _StringAdapterSink(this._sink); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 void addSlice(List<int> chunk, int startIndex, int endIndex, bool isLast) { | 160 void addSlice(List<int> chunk, int startIndex, int endIndex, bool isLast) { |
161 _decoder.convert(chunk, startIndex, endIndex); | 161 _decoder.convert(chunk, startIndex, endIndex); |
162 if (_buffer.isNotEmpty) { | 162 if (_buffer.isNotEmpty) { |
163 String accumulated = _buffer.toString(); | 163 String accumulated = _buffer.toString(); |
164 _chunkedSink.addSlice(accumulated, 0, accumulated.length, isLast); | 164 _chunkedSink.addSlice(accumulated, 0, accumulated.length, isLast); |
165 _buffer.clear(); | 165 _buffer.clear(); |
166 return;} | 166 return;} |
167 if (isLast) close(); | 167 if (isLast) close(); |
168 } | 168 } |
169 } | 169 } |
OLD | NEW |