Package io.netty5.buffer.api.internal
Class AdaptableBuffer<T extends ResourceSupport<Buffer,T>>
- java.lang.Object
-
- io.netty5.buffer.api.internal.ResourceSupport<Buffer,T>
-
- io.netty5.buffer.api.internal.AdaptableBuffer<T>
-
- All Implemented Interfaces:
BufferIntegratable
,Buffer
,BufferAccessor
,Resource<Buffer>
,ByteBufConvertible
,io.netty5.util.ReferenceCounted
,AutoCloseable
public abstract class AdaptableBuffer<T extends ResourceSupport<Buffer,T>> extends ResourceSupport<Buffer,T> implements BufferIntegratable, Buffer
-
-
Field Summary
Fields Modifier and Type Field Description protected AllocatorControl
control
-
Constructor Summary
Constructors Modifier Constructor Description protected
AdaptableBuffer(Drop<T> drop, AllocatorControl control)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ByteBuf
asByteBuf()
Turn this object into aByteBuf
.boolean
equals(Object o)
int
hashCode()
ByteBuf
initialise(ByteBufAllocatorAdaptor alloc, int maxCapacity)
int
refCnt()
boolean
release()
boolean
release(int decrement)
io.netty5.util.ReferenceCounted
retain()
io.netty5.util.ReferenceCounted
retain(int increment)
io.netty5.util.ReferenceCounted
touch()
AdaptableBuffer<T>
touch(Object hint)
Record the current access location for debugging purposes.-
Methods inherited from class io.netty5.buffer.api.internal.ResourceSupport
acquire, attachTrace, close, countBorrows, createResourceClosedException, isAccessible, isOwned, makeInaccessible, notSendableException, prepareSend, send, unsafeGetDrop, unsafeSetDrop
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.netty5.buffer.api.Buffer
bytesBefore, capacity, compact, copy, copy, copyInto, copyInto, copyInto, countComponents, countReadableComponents, countWritableComponents, ensureWritable, ensureWritable, fill, forEachReadable, forEachWritable, isDirect, makeReadOnly, openCursor, openCursor, openReverseCursor, openReverseCursor, readableBytes, readBytes, readCharSequence, readerOffset, readerOffset, readOnly, readSplit, resetOffsets, skipReadable, skipWritable, split, split, toString, transferFrom, transferTo, writableBytes, writeBytes, writeBytes, writeBytes, writeCharSequence, writerOffset, writerOffset, writeSplit
-
Methods inherited from interface io.netty5.buffer.api.BufferAccessor
getByte, getChar, getDouble, getFloat, getInt, getLong, getMedium, getShort, getUnsignedByte, getUnsignedInt, getUnsignedMedium, getUnsignedShort, readByte, readChar, readDouble, readFloat, readInt, readLong, readMedium, readShort, readUnsignedByte, readUnsignedInt, readUnsignedMedium, readUnsignedShort, setByte, setChar, setDouble, setFloat, setInt, setLong, setMedium, setShort, setUnsignedByte, setUnsignedInt, setUnsignedMedium, setUnsignedShort, writeByte, writeChar, writeDouble, writeFloat, writeInt, writeLong, writeMedium, writeShort, writeUnsignedByte, writeUnsignedInt, writeUnsignedMedium, writeUnsignedShort
-
Methods inherited from interface io.netty5.buffer.api.Resource
close, isAccessible, send
-
-
-
-
Field Detail
-
control
protected final AllocatorControl control
-
-
Constructor Detail
-
AdaptableBuffer
protected AdaptableBuffer(Drop<T> drop, AllocatorControl control)
-
-
Method Detail
-
initialise
public ByteBuf initialise(ByteBufAllocatorAdaptor alloc, int maxCapacity)
-
asByteBuf
public ByteBuf asByteBuf()
Description copied from interface:ByteBufConvertible
Turn this object into aByteBuf
. This does not increment the reference count of theByteBuf
instance. The conversion or exposure of theByteBuf
must be idempotent, so that this method can be called either once, or multiple times, without causing any change in program behaviour.- Specified by:
asByteBuf
in interfaceByteBufConvertible
- Returns:
- A
ByteBuf
instance from this object.
-
refCnt
public int refCnt()
- Specified by:
refCnt
in interfaceio.netty5.util.ReferenceCounted
-
retain
public io.netty5.util.ReferenceCounted retain()
- Specified by:
retain
in interfaceio.netty5.util.ReferenceCounted
-
retain
public io.netty5.util.ReferenceCounted retain(int increment)
- Specified by:
retain
in interfaceio.netty5.util.ReferenceCounted
-
touch
public io.netty5.util.ReferenceCounted touch()
- Specified by:
touch
in interfaceio.netty5.util.ReferenceCounted
-
touch
public AdaptableBuffer<T> touch(Object hint)
Description copied from interface:Resource
Record the current access location for debugging purposes. This information may be included if the resource throws a life-cycle related exception, or if it leaks. If this resource has already been closed, then this method has no effect.- Specified by:
touch
in interfaceio.netty5.util.ReferenceCounted
- Specified by:
touch
in interfaceResource<T extends ResourceSupport<Buffer,T>>
- Overrides:
touch
in classResourceSupport<Buffer,T extends ResourceSupport<Buffer,T>>
- Parameters:
hint
- An optional hint about this access and its context. May benull
.- Returns:
- This resource instance.
-
release
public boolean release()
- Specified by:
release
in interfaceio.netty5.util.ReferenceCounted
-
release
public boolean release(int decrement)
- Specified by:
release
in interfaceio.netty5.util.ReferenceCounted
-
-