Package io.netty5.buffer.api.internal
Interface Statics
-
public interface Statics
-
-
Field Summary
Fields Modifier and Type Field Description static MethodHandleBB_PUT_OFFSETSstatic MethodHandleBB_SLICE_OFFSETSstatic CleanerCLEANERstatic LongAdderMEM_USAGE_NATIVEstatic Drop<Buffer>NO_OP_DROP
-
Method Summary
Static Methods Modifier and Type Method Description static <T> Tacquire(ResourceSupport<?,?> obj)static IllegalStateExceptionallocatorClosedException()static voidassertValidBufferSize(long size)Check the givensizeargument is a valid buffer size, or throw anIllegalArgumentException.static voidbbput(ByteBuffer dest, int destPos, ByteBuffer src, int srcPos, int length)The ByteBuffer put-buffer-with-offset-and-length method is not available in Java 11.static ByteBufferbbslice(ByteBuffer buffer, int fromOffset, int length)The ByteBuffer slice-with-offset-and-length method is only available from Java 13 and onwards, but we need to support Java 11.static BufferClosedExceptionbufferIsClosed(Buffer buffer)static BufferReadOnlyExceptionbufferIsReadOnly(Buffer buffer)static voidcheckLength(int length)static <T,R>
Drop<R>convert(Drop<T> drop)static CharSequencecopyToCharSequence(Buffer source, int srcIdx, int length, Charset charset)static voidcopyToViaReverseLoop(Buffer src, int srcPos, Buffer dest, int destPos, int length)static intcountBorrows(ResourceSupport<?,?> obj)static booleanequals(Buffer a, int aStartIndex, Buffer b, int bStartIndex, int length)static booleanequals(Buffer bufferA, Buffer bufferB)static VarHandlefindVarHandle(MethodHandles.Lookup lookup, Class<?> recv, String name, Class<?> type)static MethodHandlegetByteBufferPutOffsetsMethodHandle()static MethodHandlegetByteBufferSliceOffsetsMethodHandle()static inthashCode(Buffer buffer)static booleanisOwned(ResourceSupport<?,?> obj)static longnativeAddressOfDirectByteBuffer(ByteBuffer byteBuffer)static longnativeAddressWithOffset(long address, int offset)Compute an offset into a native address.static CharSequencereadCharSequence(Buffer source, int length, Charset charset)static Function<Drop<Buffer>,Drop<Buffer>>standardDrop(MemoryManager manager)static <T extends Buffer>
Drop<T>standardDropWrap(Drop<T> drop, MemoryManager manager)static StringtoString(Buffer source, Charset charset)static voidunsafeSetDrop(ResourceSupport<?,?> obj, Drop<?> replacement)static voidwriteCharSequence(CharSequence source, Buffer destination, Charset charset)
-
-
-
Field Detail
-
MEM_USAGE_NATIVE
static final LongAdder MEM_USAGE_NATIVE
-
CLEANER
static final Cleaner CLEANER
-
BB_SLICE_OFFSETS
static final MethodHandle BB_SLICE_OFFSETS
-
BB_PUT_OFFSETS
static final MethodHandle BB_PUT_OFFSETS
-
-
Method Detail
-
getByteBufferSliceOffsetsMethodHandle
static MethodHandle getByteBufferSliceOffsetsMethodHandle()
-
getByteBufferPutOffsetsMethodHandle
static MethodHandle getByteBufferPutOffsetsMethodHandle()
-
standardDropWrap
static <T extends Buffer> Drop<T> standardDropWrap(Drop<T> drop, MemoryManager manager)
-
findVarHandle
static VarHandle findVarHandle(MethodHandles.Lookup lookup, Class<?> recv, String name, Class<?> type)
-
assertValidBufferSize
static void assertValidBufferSize(long size)
Check the givensizeargument is a valid buffer size, or throw anIllegalArgumentException.- Parameters:
size- The size to check.- Throws:
IllegalArgumentException- if the size is not positive, or if the size is too big (over ~2 GB) for a buffer to accommodate.
-
checkLength
static void checkLength(int length)
-
copyToViaReverseLoop
static void copyToViaReverseLoop(Buffer src, int srcPos, Buffer dest, int destPos, int length)
-
bbslice
static ByteBuffer bbslice(ByteBuffer buffer, int fromOffset, int length)
The ByteBuffer slice-with-offset-and-length method is only available from Java 13 and onwards, but we need to support Java 11.
-
bbput
static void bbput(ByteBuffer dest, int destPos, ByteBuffer src, int srcPos, int length)
The ByteBuffer put-buffer-with-offset-and-length method is not available in Java 11.
-
bufferIsClosed
static BufferClosedException bufferIsClosed(Buffer buffer)
-
bufferIsReadOnly
static BufferReadOnlyException bufferIsReadOnly(Buffer buffer)
-
allocatorClosedException
static IllegalStateException allocatorClosedException()
-
acquire
static <T> T acquire(ResourceSupport<?,?> obj)
-
isOwned
static boolean isOwned(ResourceSupport<?,?> obj)
-
countBorrows
static int countBorrows(ResourceSupport<?,?> obj)
-
unsafeSetDrop
static void unsafeSetDrop(ResourceSupport<?,?> obj, Drop<?> replacement)
-
readCharSequence
static CharSequence readCharSequence(Buffer source, int length, Charset charset)
-
copyToCharSequence
static CharSequence copyToCharSequence(Buffer source, int srcIdx, int length, Charset charset)
-
writeCharSequence
static void writeCharSequence(CharSequence source, Buffer destination, Charset charset)
-
hashCode
static int hashCode(Buffer buffer)
-
nativeAddressWithOffset
static long nativeAddressWithOffset(long address, int offset)Compute an offset into a native address. Zero is used as a marker for when a native address is not available, and an offset into a zero address will remain zero.- Parameters:
address- The native address, or zero if no native address is available.offset- The offset into the native address we wish to compute.- Returns:
- An offsetted native address, or zero if no native address was available.
-
nativeAddressOfDirectByteBuffer
static long nativeAddressOfDirectByteBuffer(ByteBuffer byteBuffer)
-
-