out.writeBytes(arr, len);
i += len;
}
assertEquals(numBytes, out.getFilePointer());
out.close();
final IndexInput in = dir.openInput("foo", IOContext.DEFAULT);
p.copy(in, numBytes);
final PagedBytes.Reader reader = p.freeze(random().nextBoolean());
for (long offset : new long[] {0L, Integer.MAX_VALUE, numBytes - 1,
_TestUtil.nextLong(random(), 1, numBytes - 2)}) {