Rather than using a read() which updates the position, requiring us to
set the position again, set it only once and use read with offset --
eliminating one syscall.
JIRA: CONTROLLER-2095
Change-Id: I478ba1cbb1f5737a751b43cb6ed0d018e49e6485
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit
fe1081dadbe4aa27600ef4454bbad5357f50e331)
// Read more bytes from the segment if necessary.
if (memory.remaining() < maxEntrySize) {
- channel.position(position);
memory.clear();
- channel.read(memory);
channel.position(position);
+ channel.read(memory, position);
memory.flip();
}