Package io.netty.buffer
Class ReadOnlyUnsafeDirectByteBuf
java.lang.Object
io.netty.buffer.ByteBuf
io.netty.buffer.AbstractByteBuf
io.netty.buffer.AbstractReferenceCountedByteBuf
io.netty.buffer.ReadOnlyByteBufferBuf
io.netty.buffer.ReadOnlyUnsafeDirectByteBuf
- All Implemented Interfaces:
ByteBufConvertible
,ReferenceCounted
,Comparable<ByteBuf>
Read-only ByteBuf which wraps a read-only direct ByteBuffer and use unsafe for best performance.
-
Field Summary
FieldsFields inherited from class io.netty.buffer.ReadOnlyByteBufferBuf
buffer
Fields inherited from class io.netty.buffer.AbstractByteBuf
checkAccessible, leakDetector, readerIndex, writerIndex
-
Constructor Summary
ConstructorsConstructorDescriptionReadOnlyUnsafeDirectByteBuf
(ByteBufAllocator allocator, ByteBuffer byteBuffer) -
Method Summary
Modifier and TypeMethodDescriptionprotected byte
_getByte
(int index) protected int
_getInt
(int index) protected long
_getLong
(int index) protected short
_getShort
(int index) protected int
_getUnsignedMedium
(int index) private long
addr
(int index) copy
(int index, int length) Returns a copy of this buffer's sub-region.getBytes
(int index, byte[] dst, int dstIndex, int length) Transfers this buffer's data to the specified destination starting at the specified absoluteindex
.Transfers this buffer's data to the specified destination starting at the specified absoluteindex
.boolean
Returnstrue
if and only if this buffer has a reference to the low-level memory address that points to the backing data.long
Returns the low-level memory address that point to the first byte of ths backing data.Methods inherited from class io.netty.buffer.ReadOnlyByteBufferBuf
_getIntLE, _getLongLE, _getShortLE, _getUnsignedMediumLE, _setByte, _setInt, _setIntLE, _setLong, _setLongLE, _setMedium, _setMediumLE, _setShort, _setShortLE, alloc, array, arrayOffset, capacity, capacity, deallocate, ensureWritable, ensureWritable, getByte, getBytes, getBytes, getBytes, getBytes, getInt, getIntLE, getLong, getLongLE, getShort, getShortLE, getUnsignedMedium, getUnsignedMediumLE, hasArray, internalNioBuffer, internalNioBuffer, isContiguous, isDirect, isReadOnly, isWritable, isWritable, nioBuffer, nioBufferCount, nioBuffers, order, setByte, setBytes, setBytes, setBytes, setBytes, setBytes, setBytes, setInt, setIntLE, setLong, setLongLE, setMedium, setMediumLE, setShort, setShortLE, unwrap
Methods inherited from class io.netty.buffer.AbstractReferenceCountedByteBuf
isAccessible, refCnt, release, release, resetRefCnt, retain, retain, setRefCnt, touch, touch
Methods inherited from class io.netty.buffer.AbstractByteBuf
adjustMarkers, asReadOnly, bytesBefore, bytesBefore, bytesBefore, checkDstIndex, checkDstIndex, checkIndex, checkIndex, checkIndex0, checkNewCapacity, checkReadableBytes, checkSrcIndex, clear, compareTo, copy, discardMarks, discardReadBytes, discardSomeReadBytes, duplicate, ensureAccessible, ensureWritable0, equals, forEachByte, forEachByte, forEachByteAsc0, forEachByteDesc, forEachByteDesc, forEachByteDesc0, getBoolean, getBytes, getBytes, getBytes, getChar, getCharSequence, getDouble, getFloat, getMedium, getMediumLE, getUnsignedByte, getUnsignedInt, getUnsignedIntLE, getUnsignedShort, getUnsignedShortLE, hashCode, indexOf, isReadable, isReadable, markReaderIndex, markWriterIndex, maxCapacity, maxCapacity, maxWritableBytes, newSwappedByteBuf, nioBuffer, nioBuffers, order, readableBytes, readBoolean, readByte, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readChar, readCharSequence, readDouble, readerIndex, readerIndex, readFloat, readInt, readIntLE, readLong, readLongLE, readMedium, readMediumLE, readRetainedSlice, readShort, readShortLE, readSlice, readUnsignedByte, readUnsignedInt, readUnsignedIntLE, readUnsignedMedium, readUnsignedMediumLE, readUnsignedShort, readUnsignedShortLE, resetReaderIndex, resetWriterIndex, retainedDuplicate, retainedSlice, retainedSlice, setBoolean, setBytes, setBytes, setBytes, setChar, setCharSequence, setDouble, setFloat, setIndex, setIndex0, setZero, skipBytes, slice, slice, toString, toString, toString, trimIndicesToCapacity, writableBytes, writeBoolean, writeByte, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeChar, writeCharSequence, writeDouble, writeFloat, writeInt, writeIntLE, writeLong, writeLongLE, writeMedium, writeMediumLE, writerIndex, writerIndex, writeShort, writeShortLE, writeZero
Methods inherited from class io.netty.buffer.ByteBuf
asByteBuf, getDoubleLE, getFloatLE, maxFastWritableBytes, readDoubleLE, readFloatLE, setDoubleLE, setFloatLE, writeDoubleLE, writeFloatLE
-
Field Details
-
memoryAddress
private final long memoryAddress
-
-
Constructor Details
-
ReadOnlyUnsafeDirectByteBuf
ReadOnlyUnsafeDirectByteBuf(ByteBufAllocator allocator, ByteBuffer byteBuffer)
-
-
Method Details
-
_getByte
protected byte _getByte(int index) - Overrides:
_getByte
in classReadOnlyByteBufferBuf
-
_getShort
protected short _getShort(int index) - Overrides:
_getShort
in classReadOnlyByteBufferBuf
-
_getUnsignedMedium
protected int _getUnsignedMedium(int index) - Overrides:
_getUnsignedMedium
in classReadOnlyByteBufferBuf
-
_getInt
protected int _getInt(int index) - Overrides:
_getInt
in classReadOnlyByteBufferBuf
-
_getLong
protected long _getLong(int index) - Overrides:
_getLong
in classReadOnlyByteBufferBuf
-
getBytes
Description copied from class:ByteBuf
Transfers this buffer's data to the specified destination starting at the specified absoluteindex
. This method does not modifyreaderIndex
orwriterIndex
of both the source (i.e.this
) and the destination.- Overrides:
getBytes
in classReadOnlyByteBufferBuf
- Parameters:
dstIndex
- the first index of the destinationlength
- the number of bytes to transfer
-
getBytes
Description copied from class:ByteBuf
Transfers this buffer's data to the specified destination starting at the specified absoluteindex
. This method does not modifyreaderIndex
orwriterIndex
of this buffer.- Overrides:
getBytes
in classReadOnlyByteBufferBuf
- Parameters:
dstIndex
- the first index of the destinationlength
- the number of bytes to transfer
-
copy
Description copied from class:ByteBuf
Returns a copy of this buffer's sub-region. Modifying the content of the returned buffer or this buffer does not affect each other at all. This method does not modifyreaderIndex
orwriterIndex
of this buffer.- Overrides:
copy
in classReadOnlyByteBufferBuf
-
hasMemoryAddress
public boolean hasMemoryAddress()Description copied from class:ByteBuf
Returnstrue
if and only if this buffer has a reference to the low-level memory address that points to the backing data.- Overrides:
hasMemoryAddress
in classReadOnlyByteBufferBuf
-
memoryAddress
public long memoryAddress()Description copied from class:ByteBuf
Returns the low-level memory address that point to the first byte of ths backing data.- Overrides:
memoryAddress
in classReadOnlyByteBufferBuf
-
addr
private long addr(int index)
-