Java Utililty Methods ByteBuffer Clear

List of utility methods to do ByteBuffer Clear

Description

The list of methods to do ByteBuffer Clear are organized into topic(s).

Method

voidfree(ByteBuffer buffer)
free
if (buffer.isDirect()) {
    Cleaner cleaner = ((DirectBuffer) buffer).cleaner();
    if (cleaner != null) {
        cleaner.clean();
voidfree(ByteBuffer buffer)
Releases memory held by the given direct ByteBuffer
if (buffer.isDirect()) {
    clean((DirectBuffer) buffer);
booleanfree(ByteBuffer byteBuffer)
Try deallocate direct byte buffer, do nothing if buffer is not direct
if (byteBuffer == null || !byteBuffer.isDirect()) {
    return false;
try {
    Method getCleanerMethod = byteBuffer.getClass().getDeclaredMethod("cleaner");
    getCleanerMethod.setAccessible(true);
    Object cleaner = getCleanerMethod.invoke(byteBuffer);
    if (cleaner != null) {
...
voidfreeDB(ByteBuffer buffer)
Forcibly free the direct buffer.
if (buffer instanceof sun.nio.ch.DirectBuffer) {
    final sun.misc.Cleaner bufferCleaner = ((sun.nio.ch.DirectBuffer) buffer).cleaner();
    bufferCleaner.clean();
voidfreeMemory(ByteBuffer buffer)
free Memory