OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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.utf; | 5 part of utf; |
6 | 6 |
7 /** | 7 /** |
8 * Decodes the UTF-16 bytes as an iterable. Thus, the consumer can only convert | 8 * Decodes the UTF-16 bytes as an iterable. Thus, the consumer can only convert |
9 * as much of the input as needed. Determines the byte order from the BOM, | 9 * as much of the input as needed. Determines the byte order from the BOM, |
10 * or uses big-endian as a default. This method always strips a leading BOM. | 10 * or uses big-endian as a default. This method always strips a leading BOM. |
11 * Set the [replacementCodepoint] to null to throw an ArgumentError | 11 * Set the [replacementCodepoint] to null to throw an ArgumentError |
12 * rather than replace the bad value. The default value for | 12 * rather than replace the bad value. The default value for |
13 * [replacementCodepoint] is U+FFFD. | 13 * [replacementCodepoint] is U+FFFD. |
14 */ | 14 */ |
15 IterableUtf16Decoder decodeUtf16AsIterable(List<int> bytes, [int offset = 0, | 15 IterableUtf16Decoder decodeUtf16AsIterable(List<int> bytes, [int offset = 0, |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 } | 328 } |
329 | 329 |
330 int decode() { | 330 int decode() { |
331 utf16EncodedBytesIterator.moveNext(); | 331 utf16EncodedBytesIterator.moveNext(); |
332 int lo = utf16EncodedBytesIterator.current; | 332 int lo = utf16EncodedBytesIterator.current; |
333 utf16EncodedBytesIterator.moveNext(); | 333 utf16EncodedBytesIterator.moveNext(); |
334 int hi = utf16EncodedBytesIterator.current; | 334 int hi = utf16EncodedBytesIterator.current; |
335 return (hi << 8) + lo; | 335 return (hi << 8) + lo; |
336 } | 336 } |
337 } | 337 } |
OLD | NEW |