looks as if we may forget flipping the buffer for sparse entries
@@ -689,6 +689,7 @@ protected int read(final long pos, final ByteBuffer buf) throws IOException {
setAtEOF(true);
} else {
entryOffset += totalRead;
+ buf.flip();
}
return totalRead;
}
@@ -741,9 +742,7 @@ private int readSparse(final long pos, final ByteBuffer buf, final int numToRead
private int readArchive(final long pos, final ByteBuffer buf) throws IOException {
channel.position(pos);
- final int read = channel.read(buf);
- buf.flip();
- return read;
+ return channel.read(buf);
}
}
}
