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 ReadOnlyByteBufferBuf
bufferFields inherited from class 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 longaddr(int index) copy(int index, int length) Returns a copy of this buffer's sub-region.protected ByteBufgetBytes(int index, byte[] dst, int dstIndex, int length, boolean internal) protected ByteBufbooleanReturnstrueif and only if this buffer has a reference to the low-level memory address that points to the backing data.longReturns the low-level memory address that point to the first byte of ths backing data.Methods inherited from class ReadOnlyByteBufferBuf
_getIntLE, _getLongLE, _getShortLE, _getUnsignedMediumLE, _setByte, _setInt, _setIntLE, _setLong, _setLongLE, _setMedium, _setMediumLE, _setShort, _setShortLE, alloc, array, arrayOffset, asReadOnly, capacity, capacity, deallocate, duplicate, ensureWritable, ensureWritable, getByte, getBytes, getBytes, getBytes, getBytes, getBytes, getBytes, getInt, getIntLE, getLong, getLongLE, getShort, getShortLE, getUnsignedMedium, getUnsignedMediumLE, hasArray, internalNioBuffer, internalNioBuffer, isContiguous, isDirect, isReadOnly, isWritable, isWritable, nioBuffer, nioBufferCount, nioBuffers, order, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, setByte, setBytes, setBytes, setBytes, setBytes, setBytes, setBytes, setInt, setIntLE, setLong, setLongLE, setMedium, setMediumLE, setShort, setShortLE, slice, unwrapMethods inherited from class AbstractReferenceCountedByteBuf
isAccessible, refCnt, release, release, resetRefCnt, retain, retain, setRefCnt, touch, touchMethods inherited from class AbstractByteBuf
_internalNioBuffer, _isDirect, _memoryAddress, adjustMarkers, bytesBefore, bytesBefore, bytesBefore, checkDstIndex, checkDstIndex, checkIndex, checkIndex, checkIndex0, checkNewCapacity, checkReadableBytes, checkSrcIndex, clear, compareTo, copy, discardMarks, discardReadBytes, discardSomeReadBytes, 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, readChar, readCharSequence, readDouble, readerIndex, readerIndex, readFloat, readInt, readIntLE, readLong, readLongLE, readMedium, readMediumLE, readRetainedSlice, readShort, readShortLE, readSlice, readString, 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, 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, writeZeroMethods inherited from class 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:
_getBytein classReadOnlyByteBufferBuf
-
_getShort
protected short _getShort(int index) - Overrides:
_getShortin classReadOnlyByteBufferBuf
-
_getUnsignedMedium
protected int _getUnsignedMedium(int index) - Overrides:
_getUnsignedMediumin classReadOnlyByteBufferBuf
-
_getInt
protected int _getInt(int index) - Overrides:
_getIntin classReadOnlyByteBufferBuf
-
_getLong
protected long _getLong(int index) - Overrides:
_getLongin classReadOnlyByteBufferBuf
-
getBytes
- Overrides:
getBytesin classReadOnlyByteBufferBuf
-
getBytes
- Overrides:
getBytesin classReadOnlyByteBufferBuf
-
copy
Description copied from class:ByteBufReturns 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 modifyreaderIndexorwriterIndexof this buffer.- Overrides:
copyin classReadOnlyByteBufferBuf
-
hasMemoryAddress
public boolean hasMemoryAddress()Description copied from class:ByteBufReturnstrueif and only if this buffer has a reference to the low-level memory address that points to the backing data.- Overrides:
hasMemoryAddressin classReadOnlyByteBufferBuf
-
memoryAddress
public long memoryAddress()Description copied from class:ByteBufReturns the low-level memory address that point to the first byte of ths backing data.- Overrides:
memoryAddressin classReadOnlyByteBufferBuf
-
addr
private long addr(int index)
-