Utf32BytesDecoder Class
Abstrace parent class converts encoded bytes to codepoints.
Subclasses
Utf32beBytesDecoder, Utf32leBytesDecoder
Constructors
Code factory Utf32BytesDecoder(List<int> utf32EncodedBytes, [int offset = 0, int length, int replacementCodepoint = UNICODE_REPLACEMENT_CHARACTER_CODEPOINT]) #
factory Utf32BytesDecoder(List<int> utf32EncodedBytes, [ int offset = 0, int length, int replacementCodepoint = UNICODE_REPLACEMENT_CHARACTER_CODEPOINT]) { if (length == null) { length = utf32EncodedBytes.length - offset; } if (hasUtf32beBom(utf32EncodedBytes, offset, length)) { return new Utf32beBytesDecoder(utf32EncodedBytes, offset + 4, length - 4, false, replacementCodepoint); } else if (hasUtf32leBom(utf32EncodedBytes, offset, length)) { return new Utf32leBytesDecoder(utf32EncodedBytes, offset + 4, length - 4, false, replacementCodepoint); } else { return new Utf32beBytesDecoder(utf32EncodedBytes, offset, length, false, replacementCodepoint); } }
Code new Utf32BytesDecoder._fromListRangeIterator(_ListRangeIterator utf32EncodedBytesIterator, int replacementCodepoint) #
Utf32BytesDecoder._fromListRangeIterator( _ListRangeIterator this.utf32EncodedBytesIterator, int this.replacementCodepoint);
Methods
Code void backup([int by = 1]) #
void backup([int by = 1]) { utf32EncodedBytesIterator.backup(4 * by); }
Code List<int> decodeRest() #
List<int> decodeRest() { List<int> codeunits = new List<int>(remaining); int i = 0; while (hasNext()) { codeunits[i++] = next(); } return codeunits; }
Code int next() #
int next() { if (utf32EncodedBytesIterator.remaining < 4) { utf32EncodedBytesIterator.skip(utf32EncodedBytesIterator.remaining); if (replacementCodepoint != null) { return replacementCodepoint; } else { throw new IllegalArgumentException( "Invalid UTF32 at ${utf32EncodedBytesIterator.position}"); } } else { int codepoint = decode(); if (_validCodepoint(codepoint)) { return codepoint; } else if (replacementCodepoint != null) { return replacementCodepoint; } else { throw new IllegalArgumentException( "Invalid UTF32 at ${utf32EncodedBytesIterator.position}"); } } }
Code void skip([int count = 1]) #
void skip([int count = 1]) { utf32EncodedBytesIterator.skip(4 * count); }
Fields
Code final _ListRangeIterator utf32EncodedBytesIterator #
final _ListRangeIterator utf32EncodedBytesIterator;