FileBuffer extends AbstractBuffer { public static FileBuffer allocate(final File file) { return allocate(file, FileBytes.DEFAULT_MODE, DEFAULT_INITIAL_CAPACITY, Integer.MAX_VALUE); } private  FileBuffer(
      final FileBytes bytes, final int offset, final int initialCapacity, final int maxCapacity); static FileBuffer allocate(final File file); static FileBuffer allocate(final File file, final int initialCapacity); static FileBuffer allocate(
      final File file, final int initialCapacity, final int maxCapacity); static FileBuffer allocate(
      final File file, final String mode, final int initialCapacity, final int maxCapacity); File file(); MappedBuffer map(final int size); MappedBuffer map(final int size, final FileChannel.MapMode mode); MappedBuffer map(final int offset, final int size); MappedBuffer map(final int offset, final int size, final FileChannel.MapMode mode); @Override FileBuffer duplicate(); FileBuffer duplicate(final String mode); void delete();  }
@Test public void testFileToHeapBuffer() { final File file = FileTesting.createFile(); try (final FileBuffer buffer = FileBuffer.allocate(file, 16)) { buffer.writeLong(10).writeLong(11).flip(); final byte[] bytes = new byte[16]; buffer.read(bytes).rewind(); final HeapBuffer heapBuffer = HeapBuffer.wrap(bytes); assertEquals(buffer.readLong(), heapBuffer.readLong()); assertEquals(buffer.readLong(), heapBuffer.readLong()); } }
@Test public void testPersist() { final File file = FileTesting.createFile(); try (final FileBuffer buffer = FileBuffer.allocate(file, 16)) { buffer.writeLong(10).writeLong(11).flip(); assertEquals(10, buffer.readLong()); assertEquals(11, buffer.readLong()); } try (final FileBuffer buffer = FileBuffer.allocate(file, 16)) { assertEquals(10, buffer.readLong()); assertEquals(11, buffer.readLong()); } }