Code example for ByteBuffer

Methods: isDirect

0
    public long getHeapCacheSize() { 
        return HEAP.getByteSize();
    } 
     
    public void release(ByteBuffer buffer) {
        if(buffer.isDirect())
            DIRECT.put(buffer);
        else 
            HEAP.put(buffer);
    } 
     
    public void clearCache() { 
        DIRECT.clear();
        HEAP.clear();
    } 
 
}