- // Read more bytes from the segment if necessary.
- if (memory.remaining() < maxEntrySize) {
- memory.clear();
- channel.read(memory);
- channel.position(position);
- memory.flip();
- }
+ // Clear memory buffer and read fist chunk
+ memory.clear();
+ channel.read(memory, position);
+ memory.flip();