Class UnpooledByteBufAllocator.DecrementingCleanableDirectBuffer
java.lang.Object
io.netty.buffer.UnpooledByteBufAllocator.DecrementingCleanableDirectBuffer
- All Implemented Interfaces:
CleanableDirectBuffer
- Enclosing class:
UnpooledByteBufAllocator
private static final class UnpooledByteBufAllocator.DecrementingCleanableDirectBuffer
extends Object
implements CleanableDirectBuffer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final UnpooledByteBufAllocatorprivate final CleanableDirectBuffer -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateDecrementingCleanableDirectBuffer(ByteBufAllocator alloc, CleanableDirectBuffer delegate) privateDecrementingCleanableDirectBuffer(ByteBufAllocator alloc, CleanableDirectBuffer delegate, int capacityConsumed) -
Method Summary
Modifier and TypeMethodDescriptionbuffer()Get the buffer instance.voidclean()Deallocate the buffer.booleanlongGet the native memory address, but only ifCleanableDirectBuffer.hasMemoryAddress()returns true, otherwise this may return an unspecified value or throw an exception.
-
Field Details
-
alloc
-
delegate
-
-
Constructor Details
-
DecrementingCleanableDirectBuffer
-
DecrementingCleanableDirectBuffer
private DecrementingCleanableDirectBuffer(ByteBufAllocator alloc, CleanableDirectBuffer delegate, int capacityConsumed)
-
-
Method Details
-
buffer
Description copied from interface:CleanableDirectBufferGet the buffer instance.Note: the buffer must not be accessed after the
CleanableDirectBuffer.clean()method has been called.- Specified by:
bufferin interfaceCleanableDirectBuffer- Returns:
- The
ByteBufferinstance.
-
clean
public void clean()Description copied from interface:CleanableDirectBufferDeallocate the buffer. This method can only be called once per instance, and all usages of the buffer must have ceased before this method is called, and the buffer must not be accessed again after this method has been called.- Specified by:
cleanin interfaceCleanableDirectBuffer
-
hasMemoryAddress
public boolean hasMemoryAddress()- Specified by:
hasMemoryAddressin interfaceCleanableDirectBuffer- Returns:
trueif the native memory address is available, otherwisefalse.
-
memoryAddress
public long memoryAddress()Description copied from interface:CleanableDirectBufferGet the native memory address, but only ifCleanableDirectBuffer.hasMemoryAddress()returns true, otherwise this may return an unspecified value or throw an exception.- Specified by:
memoryAddressin interfaceCleanableDirectBuffer- Returns:
- The native memory address of this buffer, if available.
-