readBits method
Implementation
int readBits(int numBits) {
// Flag an error if end_of_stream or n_bits is more than allowed limit.
if (!isEOS && numBits < MAX_NUM_BIT_READ) {
//final value = (buffer >> bitPos) & BIT_MASK[numBits];
final value = prefetchBits() & BIT_MASK[numBits];
bitPos += numBits;
_shiftBytes();
return value;
} else {
throw ImageException('Not enough data in input.');
}
}