OLD | NEW |
1 part of dart.convert; | 1 part of dart.convert; |
2 const int UNICODE_REPLACEMENT_CHARACTER_RUNE = 0xFFFD; | 2 const int UNICODE_REPLACEMENT_CHARACTER_RUNE = 0xFFFD; |
3 const int UNICODE_BOM_CHARACTER_RUNE = 0xFEFF; | 3 const int UNICODE_BOM_CHARACTER_RUNE = 0xFEFF; |
4 const Utf8Codec UTF8 = const Utf8Codec(); | 4 const Utf8Codec UTF8 = const Utf8Codec(); |
5 class Utf8Codec extends Encoding {final bool _allowMalformed; | 5 class Utf8Codec extends Encoding {final bool _allowMalformed; |
6 const Utf8Codec({ | 6 const Utf8Codec({ |
7 bool allowMalformed : false} | 7 bool allowMalformed : false} |
8 ) : _allowMalformed = allowMalformed; | 8 ) : _allowMalformed = allowMalformed; |
9 String get name => "utf-8"; | 9 String get name => "utf-8"; |
10 String decode(List<int> codeUnits, { | 10 String decode(List<int> codeUnits, { |
(...skipping 23 matching lines...) Expand all Loading... |
34 return encoder._buffer.sublist(0, encoder._bufferIndex); | 34 return encoder._buffer.sublist(0, encoder._bufferIndex); |
35 } | 35 } |
36 StringConversionSink startChunkedConversion(Sink<List<int>> sink) { | 36 StringConversionSink startChunkedConversion(Sink<List<int>> sink) { |
37 if (sink is! ByteConversionSink) { | 37 if (sink is! ByteConversionSink) { |
38 sink = new ByteConversionSink.from(sink); | 38 sink = new ByteConversionSink.from(sink); |
39 } | 39 } |
40 return new _Utf8EncoderSink(DEVC$RT.cast(sink, DEVC$RT.type((Sink<List<int>> _)
{ | 40 return new _Utf8EncoderSink(DEVC$RT.cast(sink, DEVC$RT.type((Sink<List<int>> _)
{ |
41 } | 41 } |
42 ), ByteConversionSink, "ImplicitCast", """line 125, column 33 of dart:convert/ut
f.dart: """, sink is ByteConversionSink, true)); | 42 ), ByteConversionSink, "ImplicitCast", """line 125, column 33 of dart:convert/ut
f.dart: """, sink is ByteConversionSink, true)); |
43 } | 43 } |
44 Stream<List<int>> bind(Stream<String> stream) => ((__x18) => DEVC$RT.cast(__x18
, DEVC$RT.type((DDC$async$.Stream<dynamic> _) { | 44 Stream<List<int>> bind(Stream<String> stream) => ((__x15) => DEVC$RT.cast(__x15
, DEVC$RT.type((DDC$async$.Stream<dynamic> _) { |
45 } | 45 } |
46 ), DEVC$RT.type((DDC$async$.Stream<List<int>> _) { | 46 ), DEVC$RT.type((DDC$async$.Stream<List<int>> _) { |
47 } | 47 } |
48 ), "CompositeCast", """line 129, column 52 of dart:convert/utf.dart: """, __x18
is DDC$async$.Stream<List<int>>, false))(super.bind(stream)); | 48 ), "CompositeCast", """line 129, column 52 of dart:convert/utf.dart: """, __x15
is DDC$async$.Stream<List<int>>, false))(super.bind(stream)); |
49 } | 49 } |
50 class _Utf8Encoder {int _carry = 0; | 50 class _Utf8Encoder {int _carry = 0; |
51 int _bufferIndex = 0; | 51 int _bufferIndex = 0; |
52 final List<int> _buffer; | 52 final List<int> _buffer; |
53 static const _DEFAULT_BYTE_BUFFER_SIZE = 1024; | 53 static const _DEFAULT_BYTE_BUFFER_SIZE = 1024; |
54 _Utf8Encoder() : this.withBufferSize(_DEFAULT_BYTE_BUFFER_SIZE); | 54 _Utf8Encoder() : this.withBufferSize(_DEFAULT_BYTE_BUFFER_SIZE); |
55 _Utf8Encoder.withBufferSize(int bufferSize) : _buffer = _createBuffer(bufferSiz
e); | 55 _Utf8Encoder.withBufferSize(int bufferSize) : _buffer = _createBuffer(bufferSiz
e); |
56 static List<int> _createBuffer(int size) => new Uint8List(size); | 56 static List<int> _createBuffer(int size) => new Uint8List(size); |
57 bool _writeSurrogate(int leadingSurrogate, int nextCodeUnit) { | 57 bool _writeSurrogate(int leadingSurrogate, int nextCodeUnit) { |
58 if (_isTailSurrogate(nextCodeUnit)) { | 58 if (_isTailSurrogate(nextCodeUnit)) { |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 ByteConversionSink startChunkedConversion(Sink<String> sink) { | 163 ByteConversionSink startChunkedConversion(Sink<String> sink) { |
164 StringConversionSink stringSink; | 164 StringConversionSink stringSink; |
165 if (sink is StringConversionSink) { | 165 if (sink is StringConversionSink) { |
166 stringSink = sink; | 166 stringSink = sink; |
167 } | 167 } |
168 else { | 168 else { |
169 stringSink = new StringConversionSink.from(sink); | 169 stringSink = new StringConversionSink.from(sink); |
170 } | 170 } |
171 return stringSink.asUtf8Sink(_allowMalformed); | 171 return stringSink.asUtf8Sink(_allowMalformed); |
172 } | 172 } |
173 Stream<String> bind(Stream<List<int>> stream) => ((__x19) => DEVC$RT.cast(__x19
, DEVC$RT.type((DDC$async$.Stream<dynamic> _) { | 173 Stream<String> bind(Stream<List<int>> stream) => ((__x16) => DEVC$RT.cast(__x16
, DEVC$RT.type((DDC$async$.Stream<dynamic> _) { |
174 } | 174 } |
175 ), DEVC$RT.type((DDC$async$.Stream<String> _) { | 175 ), DEVC$RT.type((DDC$async$.Stream<String> _) { |
176 } | 176 } |
177 ), "CompositeCast", """line 361, column 52 of dart:convert/utf.dart: """, __x19
is DDC$async$.Stream<String>, false))(super.bind(stream)); | 177 ), "CompositeCast", """line 361, column 52 of dart:convert/utf.dart: """, __x16
is DDC$async$.Stream<String>, false))(super.bind(stream)); |
178 external Converter<List<int>, dynamic> fuse(Converter<String, dynamic> next); | 178 external Converter<List<int>, dynamic> fuse(Converter<String, dynamic> next); |
179 } | 179 } |
180 const int _ONE_BYTE_LIMIT = 0x7f; | 180 const int _ONE_BYTE_LIMIT = 0x7f; |
181 const int _TWO_BYTE_LIMIT = 0x7ff; | 181 const int _TWO_BYTE_LIMIT = 0x7ff; |
182 const int _THREE_BYTE_LIMIT = 0xffff; | 182 const int _THREE_BYTE_LIMIT = 0xffff; |
183 const int _FOUR_BYTE_LIMIT = 0x10ffff; | 183 const int _FOUR_BYTE_LIMIT = 0x10ffff; |
184 const int _SURROGATE_MASK = 0xF800; | 184 const int _SURROGATE_MASK = 0xF800; |
185 const int _SURROGATE_TAG_MASK = 0xFC00; | 185 const int _SURROGATE_TAG_MASK = 0xFC00; |
186 const int _SURROGATE_VALUE_MASK = 0x3FF; | 186 const int _SURROGATE_VALUE_MASK = 0x3FF; |
187 const int _LEAD_SURROGATE_MIN = 0xD800; | 187 const int _LEAD_SURROGATE_MIN = 0xD800; |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 } | 315 } |
316 break loop; | 316 break loop; |
317 } | 317 } |
318 if (expectedUnits > 0) { | 318 if (expectedUnits > 0) { |
319 _value = value; | 319 _value = value; |
320 _expectedUnits = expectedUnits; | 320 _expectedUnits = expectedUnits; |
321 _extraUnits = extraUnits; | 321 _extraUnits = extraUnits; |
322 } | 322 } |
323 } | 323 } |
324 } | 324 } |
OLD | NEW |