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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 stringSink = sink; | 363 stringSink = sink; |
364 } else { | 364 } else { |
365 stringSink = new StringConversionSink.from(sink); | 365 stringSink = new StringConversionSink.from(sink); |
366 } | 366 } |
367 return stringSink.asUtf8Sink(_allowMalformed); | 367 return stringSink.asUtf8Sink(_allowMalformed); |
368 } | 368 } |
369 | 369 |
370 // Override the base-classes bind, to provide a better type. | 370 // Override the base-classes bind, to provide a better type. |
371 Stream<String> bind(Stream<List<int>> stream) => super.bind(stream); | 371 Stream<String> bind(Stream<List<int>> stream) => super.bind(stream); |
372 | 372 |
373 external Converter<List<int>, dynamic/*=T*/> fuse/*<T>*/( | 373 external Converter<List<int>, T> fuse<T>(Converter<String, T> next); |
374 Converter<String, dynamic/*=T*/> next); | |
375 | 374 |
376 external static String _convertIntercepted( | 375 external static String _convertIntercepted( |
377 bool allowMalformed, List<int> codeUnits, int start, int end); | 376 bool allowMalformed, List<int> codeUnits, int start, int end); |
378 } | 377 } |
379 | 378 |
380 // UTF-8 constants. | 379 // UTF-8 constants. |
381 const int _ONE_BYTE_LIMIT = 0x7f; // 7 bits | 380 const int _ONE_BYTE_LIMIT = 0x7f; // 7 bits |
382 const int _TWO_BYTE_LIMIT = 0x7ff; // 11 bits | 381 const int _TWO_BYTE_LIMIT = 0x7ff; // 11 bits |
383 const int _THREE_BYTE_LIMIT = 0xffff; // 16 bits | 382 const int _THREE_BYTE_LIMIT = 0xffff; // 16 bits |
384 const int _FOUR_BYTE_LIMIT = 0x10ffff; // 21 bits, truncated to Unicode max. | 383 const int _FOUR_BYTE_LIMIT = 0x10ffff; // 21 bits, truncated to Unicode max. |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 } | 565 } |
567 break loop; | 566 break loop; |
568 } | 567 } |
569 if (expectedUnits > 0) { | 568 if (expectedUnits > 0) { |
570 _value = value; | 569 _value = value; |
571 _expectedUnits = expectedUnits; | 570 _expectedUnits = expectedUnits; |
572 _extraUnits = extraUnits; | 571 _extraUnits = extraUnits; |
573 } | 572 } |
574 } | 573 } |
575 } | 574 } |
OLD | NEW |