protected Buffer batch(boolean get, int index, ByteBuffer buffer, int length) {
Entry entry = getEntry(index);
int off = index - entry.position;
do {
Buffer content = entry.buffer;
int len = Math.min(content.remaining() - off, length);
if (get)
content.get(content.position() + off, buffer, len);
else {
content.put(content.position() + off, buffer, len);