| 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 19 matching lines...) Expand all Loading... |
| 30 assert (endPosition >= end - 1); if (endPosition != end) { | 30 assert (endPosition >= end - 1); if (endPosition != end) { |
| 31 int lastCodeUnit = string.codeUnitAt(end - 1); | 31 int lastCodeUnit = string.codeUnitAt(end - 1); |
| 32 assert (_isLeadSurrogate(lastCodeUnit)); bool wasCombined = encoder._writeSur
rogate(lastCodeUnit, 0); | 32 assert (_isLeadSurrogate(lastCodeUnit)); bool wasCombined = encoder._writeSur
rogate(lastCodeUnit, 0); |
| 33 assert (!wasCombined);} | 33 assert (!wasCombined);} |
| 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(sink); | 40 return new _Utf8EncoderSink(DDC$RT.cast(sink, DDC$RT.type((Sink<List<int>> _) { |
| 41 } |
| 42 ), ByteConversionSink, "CastGeneral", """line 125, column 33 of dart:convert/utf
.dart: """, sink is ByteConversionSink, true)); |
| 41 } | 43 } |
| 42 Stream<List<int>> bind(Stream<String> stream) => ((__x30) => DDC$RT.cast(__x30,
DDC$RT.type((DDC$async$.Stream<dynamic> _) { | 44 Stream<List<int>> bind(Stream<String> stream) => ((__x33) => DDC$RT.cast(__x33,
DDC$RT.type((DDC$async$.Stream<dynamic> _) { |
| 43 } | 45 } |
| 44 ), DDC$RT.type((DDC$async$.Stream<List<int>> _) { | 46 ), DDC$RT.type((DDC$async$.Stream<List<int>> _) { |
| 45 } | 47 } |
| 46 ), "CastDynamic", """line 129, column 52 of dart:convert/utf.dart: """, __x30 is
DDC$async$.Stream<List<int>>, false))(super.bind(stream)); | 48 ), "CastDynamic", """line 129, column 52 of dart:convert/utf.dart: """, __x33 is
DDC$async$.Stream<List<int>>, false))(super.bind(stream)); |
| 47 } | 49 } |
| 48 class _Utf8Encoder {int _carry = 0; | 50 class _Utf8Encoder {int _carry = 0; |
| 49 int _bufferIndex = 0; | 51 int _bufferIndex = 0; |
| 50 final List<int> _buffer; | 52 final List<int> _buffer; |
| 51 static const _DEFAULT_BYTE_BUFFER_SIZE = 1024; | 53 static const _DEFAULT_BYTE_BUFFER_SIZE = 1024; |
| 52 _Utf8Encoder() : this.withBufferSize(DDC$RT.cast(_DEFAULT_BYTE_BUFFER_SIZE, dyn
amic, int, "CastGeneral", """line 143, column 40 of dart:convert/utf.dart: """,
_DEFAULT_BYTE_BUFFER_SIZE is int, true)); | 54 _Utf8Encoder() : this.withBufferSize(DDC$RT.cast(_DEFAULT_BYTE_BUFFER_SIZE, dyn
amic, int, "CastGeneral", """line 143, column 40 of dart:convert/utf.dart: """,
_DEFAULT_BYTE_BUFFER_SIZE is int, true)); |
| 53 _Utf8Encoder.withBufferSize(int bufferSize) : _buffer = _createBuffer(bufferSiz
e); | 55 _Utf8Encoder.withBufferSize(int bufferSize) : _buffer = _createBuffer(bufferSiz
e); |
| 54 static List<int> _createBuffer(int size) => new Uint8List(size); | 56 static List<int> _createBuffer(int size) => new Uint8List(size); |
| 55 bool _writeSurrogate(int leadingSurrogate, int nextCodeUnit) { | 57 bool _writeSurrogate(int leadingSurrogate, int nextCodeUnit) { |
| 56 if (_isTailSurrogate(nextCodeUnit)) { | 58 if (_isTailSurrogate(nextCodeUnit)) { |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 ByteConversionSink startChunkedConversion(Sink<String> sink) { | 163 ByteConversionSink startChunkedConversion(Sink<String> sink) { |
| 162 StringConversionSink stringSink; | 164 StringConversionSink stringSink; |
| 163 if (sink is StringConversionSink) { | 165 if (sink is StringConversionSink) { |
| 164 stringSink = sink; | 166 stringSink = sink; |
| 165 } | 167 } |
| 166 else { | 168 else { |
| 167 stringSink = new StringConversionSink.from(sink); | 169 stringSink = new StringConversionSink.from(sink); |
| 168 } | 170 } |
| 169 return stringSink.asUtf8Sink(_allowMalformed); | 171 return stringSink.asUtf8Sink(_allowMalformed); |
| 170 } | 172 } |
| 171 Stream<String> bind(Stream<List<int>> stream) => ((__x31) => DDC$RT.cast(__x31,
DDC$RT.type((DDC$async$.Stream<dynamic> _) { | 173 Stream<String> bind(Stream<List<int>> stream) => ((__x34) => DDC$RT.cast(__x34,
DDC$RT.type((DDC$async$.Stream<dynamic> _) { |
| 172 } | 174 } |
| 173 ), DDC$RT.type((DDC$async$.Stream<String> _) { | 175 ), DDC$RT.type((DDC$async$.Stream<String> _) { |
| 174 } | 176 } |
| 175 ), "CastDynamic", """line 361, column 52 of dart:convert/utf.dart: """, __x31 is
DDC$async$.Stream<String>, false))(super.bind(stream)); | 177 ), "CastDynamic", """line 361, column 52 of dart:convert/utf.dart: """, __x34 is
DDC$async$.Stream<String>, false))(super.bind(stream)); |
| 176 external Converter<List<int>, dynamic> fuse(Converter<String, dynamic> next); | 178 external Converter<List<int>, dynamic> fuse(Converter<String, dynamic> next); |
| 177 } | 179 } |
| 178 const int _ONE_BYTE_LIMIT = 0x7f; | 180 const int _ONE_BYTE_LIMIT = 0x7f; |
| 179 const int _TWO_BYTE_LIMIT = 0x7ff; | 181 const int _TWO_BYTE_LIMIT = 0x7ff; |
| 180 const int _THREE_BYTE_LIMIT = 0xffff; | 182 const int _THREE_BYTE_LIMIT = 0xffff; |
| 181 const int _FOUR_BYTE_LIMIT = 0x10ffff; | 183 const int _FOUR_BYTE_LIMIT = 0x10ffff; |
| 182 const int _SURROGATE_MASK = 0xF800; | 184 const int _SURROGATE_MASK = 0xF800; |
| 183 const int _SURROGATE_TAG_MASK = 0xFC00; | 185 const int _SURROGATE_TAG_MASK = 0xFC00; |
| 184 const int _SURROGATE_VALUE_MASK = 0x3FF; | 186 const int _SURROGATE_VALUE_MASK = 0x3FF; |
| 185 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... |
| 313 } | 315 } |
| 314 break loop; | 316 break loop; |
| 315 } | 317 } |
| 316 if (expectedUnits > 0) { | 318 if (expectedUnits > 0) { |
| 317 _value = value; | 319 _value = value; |
| 318 _expectedUnits = expectedUnits; | 320 _expectedUnits = expectedUnits; |
| 319 _extraUnits = extraUnits; | 321 _extraUnits = extraUnits; |
| 320 } | 322 } |
| 321 } | 323 } |
| 322 } | 324 } |
| OLD | NEW |