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,java.lang.Comparable<ByteBuf>
final class ReadOnlyUnsafeDirectByteBuf extends ReadOnlyByteBufferBuf
Read-only ByteBuf which wraps a read-only direct ByteBuffer and use unsafe for best performance.
-
-
Field Summary
Fields Modifier and Type Field Description private longmemoryAddress-
Fields inherited from class io.netty.buffer.ReadOnlyByteBufferBuf
buffer
-
Fields inherited from class io.netty.buffer.AbstractByteBuf
checkAccessible, leakDetector, readerIndex, writerIndex
-
-
Constructor Summary
Constructors Constructor Description ReadOnlyUnsafeDirectByteBuf(ByteBufAllocator allocator, java.nio.ByteBuffer byteBuffer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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)ByteBufcopy(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 ByteBufgetBytes(int index, ByteBuf dst, int dstIndex, int length, boolean internal)booleanhasMemoryAddress()Returnstrueif and only if this buffer has a reference to the low-level memory address that points to the backing data.longmemoryAddress()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, 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, 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
_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, writeZero
-
Methods inherited from class io.netty.buffer.ByteBuf
asByteBuf, getDoubleLE, getFloatLE, maxFastWritableBytes, readDoubleLE, readFloatLE, setDoubleLE, setFloatLE, writeDoubleLE, writeFloatLE
-
-
-
-
Constructor Detail
-
ReadOnlyUnsafeDirectByteBuf
ReadOnlyUnsafeDirectByteBuf(ByteBufAllocator allocator, java.nio.ByteBuffer byteBuffer)
-
-
Method Detail
-
_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
protected ByteBuf getBytes(int index, ByteBuf dst, int dstIndex, int length, boolean internal)
- Overrides:
getBytesin classReadOnlyByteBufferBuf
-
getBytes
protected ByteBuf getBytes(int index, byte[] dst, int dstIndex, int length, boolean internal)
- Overrides:
getBytesin classReadOnlyByteBufferBuf
-
copy
public ByteBuf copy(int index, int length)
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)
-
-