readWriteMustFail(raf, sz, buf, 0, buf.length); // Read, write at the end fail.
readWriteMustFail(raf, sz+1, buf, 0, buf.length); // One byte into end
readWriteMustFail(raf, sz+1025, buf, 0, buf.length); // 1KB in
readWriteMustFail(raf, sz+buf.length, buf, 0, buf.length);
raf.close();
raf.free();
}
private void readWriteMustSucceed(RandomAccessBuffer raf, long startAt, byte[] buf, int offset, int length) throws IOException {
raf.pread(startAt, buf, 0, buf.length); // Should work
raf.pwrite(startAt, buf, 0, buf.length); // Should work