Package io.netty5.buffer.api.internal
Interface Statics
-
public interface Statics
-
-
Field Summary
Fields Modifier and Type Field Description static MethodHandle
BB_PUT_OFFSETS
static MethodHandle
BB_SLICE_OFFSETS
static Cleaner
CLEANER
static LongAdder
MEM_USAGE_NATIVE
static Drop<Buffer>
NO_OP_DROP
-
Method Summary
Static Methods Modifier and Type Method Description static <T> T
acquire(ResourceSupport<?,?> obj)
static IllegalStateException
allocatorClosedException()
static void
assertValidBufferSize(long size)
Check the givensize
argument is a valid buffer size, or throw anIllegalArgumentException
.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.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.static BufferClosedException
bufferIsClosed(Buffer buffer)
static BufferReadOnlyException
bufferIsReadOnly(Buffer buffer)
static void
checkLength(int length)
static <T,R>
Drop<R>convert(Drop<T> drop)
static CharSequence
copyToCharSequence(Buffer source, int srcIdx, int length, Charset charset)
static void
copyToViaReverseLoop(Buffer src, int srcPos, Buffer dest, int destPos, int length)
static int
countBorrows(ResourceSupport<?,?> obj)
static boolean
equals(Buffer a, int aStartIndex, Buffer b, int bStartIndex, int length)
static boolean
equals(Buffer bufferA, Buffer bufferB)
static VarHandle
findVarHandle(MethodHandles.Lookup lookup, Class<?> recv, String name, Class<?> type)
static MethodHandle
getByteBufferPutOffsetsMethodHandle()
static MethodHandle
getByteBufferSliceOffsetsMethodHandle()
static int
hashCode(Buffer buffer)
static boolean
isOwned(ResourceSupport<?,?> obj)
static long
nativeAddressOfDirectByteBuffer(ByteBuffer byteBuffer)
static long
nativeAddressWithOffset(long address, int offset)
Compute an offset into a native address.static CharSequence
readCharSequence(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 String
toString(Buffer source, Charset charset)
static void
unsafeSetDrop(ResourceSupport<?,?> obj, Drop<?> replacement)
static void
writeCharSequence(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 givensize
argument 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)
-
-