| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of dart.convert; | 5 part of dart.convert; |
| 6 | 6 |
| 7 /** The Unicode Replacement character `U+FFFD` (�). */ | 7 /** The Unicode Replacement character `U+FFFD` (�). */ |
| 8 const int UNICODE_REPLACEMENT_CHARACTER_RUNE = 0xFFFD; | 8 const int UNICODE_REPLACEMENT_CHARACTER_RUNE = 0xFFFD; |
| 9 | 9 |
| 10 /** The Unicode Byte Order Marker (BOM) character `U+FEFF`. */ | 10 /** The Unicode Byte Order Marker (BOM) character `U+FEFF`. */ |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 if (sink is StringConversionSink) { | 335 if (sink is StringConversionSink) { |
| 336 stringSink = sink; | 336 stringSink = sink; |
| 337 } else { | 337 } else { |
| 338 stringSink = new StringConversionSink.from(sink); | 338 stringSink = new StringConversionSink.from(sink); |
| 339 } | 339 } |
| 340 return stringSink.asUtf8Sink(_allowMalformed); | 340 return stringSink.asUtf8Sink(_allowMalformed); |
| 341 } | 341 } |
| 342 | 342 |
| 343 // Override the base-classes bind, to provide a better type. | 343 // Override the base-classes bind, to provide a better type. |
| 344 Stream<String> bind(Stream<List<int>> stream) => super.bind(stream); | 344 Stream<String> bind(Stream<List<int>> stream) => super.bind(stream); |
| 345 |
| 346 external Converter<List<int>,dynamic> fuse(Converter<String, dynamic> next); |
| 345 } | 347 } |
| 346 | 348 |
| 347 // UTF-8 constants. | 349 // UTF-8 constants. |
| 348 const int _ONE_BYTE_LIMIT = 0x7f; // 7 bits | 350 const int _ONE_BYTE_LIMIT = 0x7f; // 7 bits |
| 349 const int _TWO_BYTE_LIMIT = 0x7ff; // 11 bits | 351 const int _TWO_BYTE_LIMIT = 0x7ff; // 11 bits |
| 350 const int _THREE_BYTE_LIMIT = 0xffff; // 16 bits | 352 const int _THREE_BYTE_LIMIT = 0xffff; // 16 bits |
| 351 const int _FOUR_BYTE_LIMIT = 0x10ffff; // 21 bits, truncated to Unicode max. | 353 const int _FOUR_BYTE_LIMIT = 0x10ffff; // 21 bits, truncated to Unicode max. |
| 352 | 354 |
| 353 // UTF-16 constants. | 355 // UTF-16 constants. |
| 354 const int _SURROGATE_MASK = 0xF800; | 356 const int _SURROGATE_MASK = 0xF800; |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 } | 538 } |
| 537 break loop; | 539 break loop; |
| 538 } | 540 } |
| 539 if (expectedUnits > 0) { | 541 if (expectedUnits > 0) { |
| 540 _value = value; | 542 _value = value; |
| 541 _expectedUnits = expectedUnits; | 543 _expectedUnits = expectedUnits; |
| 542 _extraUnits = extraUnits; | 544 _extraUnits = extraUnits; |
| 543 } | 545 } |
| 544 } | 546 } |
| 545 } | 547 } |
| OLD | NEW |