* @param length The number of characters to read.
* @throws IOException If an error (including EOF) occurred while reading the stream.
*/
final void readFully(final int dataSize, int offset, int length) throws IOException {
ensureBufferContains(Math.min(length * dataSize, buffer.capacity()));
final Buffer view = createView(); // Must be after ensureBufferContains
int n = Math.min(view.remaining(), length);
transfer(offset, n);
skipInBuffer(n * dataSize);
while ((length -= n) != 0) {
offset += n;
ensureBufferContains(dataSize);
view.position(0).limit(buffer.remaining() / dataSize);
transfer(offset, n = Math.min(view.remaining(), length));
skipInBuffer(n * dataSize);
}
}