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:
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.ByteBufgetBytes(int index, byte[] dst, int dstIndex, int length)Transfers this buffer's data to the specified destination starting at the specified absoluteindex.ByteBufgetBytes(int index, ByteBuf dst, int dstIndex, int length)Transfers this buffer's data to the specified destination starting at the specified absoluteindex.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, 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
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
public ByteBuf getBytes(int index, ByteBuf dst, int dstIndex, int length)
Description copied from class:ByteBufTransfers this buffer's data to the specified destination starting at the specified absoluteindex. This method does not modifyreaderIndexorwriterIndexof both the source (i.e.this) and the destination.- Overrides:
getBytesin classReadOnlyByteBufferBufdstIndex- the first index of the destinationlength- the number of bytes to transfer
-
getBytes
public ByteBuf getBytes(int index, byte[] dst, int dstIndex, int length)
Description copied from class:ByteBufTransfers this buffer's data to the specified destination starting at the specified absoluteindex. This method does not modifyreaderIndexorwriterIndexof this buffer.- Overrides:
getBytesin classReadOnlyByteBufferBufdstIndex- the first index of the destinationlength- the number of bytes to transfer
-
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)
-
-