getECIValue method
Returns the int
ECI value at the specified index. An index ranges from zero
to length - 1
. The first byte
value of the sequence is at
index zero, the next at index one, and so on, as for array
indexing.
@param index the index of the int
value to be returned
@return the specified int
ECI value.
The ECI specified the encoding of all bytes with a higher index until the
next ECI or until the end of the input if no other ECI follows.
@throws IndexOutOfBoundsException
if the index
argument is negative or not less than
length
@throws IllegalArgumentException
if the value at the index
argument is not an ECI (@see #isECI)
Implementation
@override
int getECIValue(int index) {
if (index < 0 || index >= length) {
// IndexOutOfBoundsException
throw IndexError.withLength(index, length);
}
if (!isECI(index)) {
//IllegalArgumentException
throw ArgumentError('value at $index is not an ECI but a character');
}
return bytes[index] - 256;
}