Code example for ByteBuffer

Methods: limit, put, rewind

0
    } 
 
    @Override 
    public void putMemoryBlockWithGivenByteArray(byte[] byteArray) {
        ByteBuffer byteBuffer = getMemoryBlockAsByteBuffer();
    	byteBuffer.put(byteArray);
    	byteBuffer.rewind();
    	byteBuffer.limit(byteArray.length);
    } 
 
    @Override 
    public boolean isOffJVMHeap() { 
        return offJVMHeap;
    } 
 
    @Override 
    public void reset() { 
        buffer.clear();
    } 
}