HeapBuffer extends ByteBufferBuffer { public static HeapBuffer allocate() { return allocate(DEFAULT_INITIAL_CAPACITY, MAX_SIZE); } protected  HeapBuffer(
      final HeapBytes bytes, final int offset, final int initialCapacity, final int maxCapacity); static HeapBuffer allocate(); static HeapBuffer allocate(final int initialCapacity); static HeapBuffer allocate(final int initialCapacity, final int maxCapacity); static HeapBuffer wrap(final byte[] bytes); @Override boolean hasArray(); @Override HeapBuffer duplicate();  }
@Test public void testHeapToDirectBuffer() { final HeapBuffer heapBuffer = HeapBuffer.allocate(8); heapBuffer.writeLong(10); heapBuffer.flip(); final DirectBuffer directBuffer = DirectBuffer.allocate(8); directBuffer.write(heapBuffer.array()); directBuffer.flip(); assertEquals(directBuffer.readLong(), heapBuffer.readLong()); directBuffer.release(); }