Top Description Fields Constructors Methods
io.netty.buffer

public Class UnpooledUnsafeDirectByteBuf

extends UnpooledDirectByteBuf
Class Inheritance
Known Direct Subclasses
io.netty.buffer.UnpooledUnsafeNoCleanerDirectByteBuf, io.netty.buffer.WrappedUnpooledUnsafeDirectByteBuf, io.netty.buffer.ByteBufUtil.ThreadLocalUnsafeDirectByteBuf, io.netty.buffer.UnpooledByteBufAllocator.InstrumentedUnpooledUnsafeDirectByteBuf
Imports
io.netty.util.internal.PlatformDependent, java.io.IOException, .InputStream, .OutputStream, java.nio.ByteBuffer

A NIO ByteBuffer based buffer. It is recommended to use UnpooledByteBufAllocator#directBuffer(int, int), Unpooled#directBuffer(int) and Unpooled#wrappedBuffer(ByteBuffer) instead of calling the constructor explicitly.}

Field Summary

Modifier and TypeField and Description
pack-priv long
Inherited from io.netty.buffer.UnpooledDirectByteBuf:
buffer

Constructor Summary

AccessConstructor and Description
public
UnpooledUnsafeDirectByteBuf(ByteBufAllocator alloc, int
the initial capacity of the underlying direct buffer
initialCapacity
,
int
the maximum capacity of the underlying direct buffer
maxCapacity
)

Creates a new direct buffer.

protected
UnpooledUnsafeDirectByteBuf(ByteBufAllocator alloc, ByteBuffer initialBuffer, int
the maximum capacity of the underlying direct buffer
maxCapacity
)

Creates a new direct buffer by wrapping the specified initial buffer.

pack-priv
UnpooledUnsafeDirectByteBuf(ByteBufAllocator alloc, ByteBuffer initialBuffer, int maxCapacity, boolean doFree)

Method Summary

Modifier and TypeMethod and Description
protected byte
protected int
protected int
protected long
protected long
protected short
protected short
protected int
protected int
protected void
protected void
protected void
protected void
protected void
protected void
protected void
protected void
protected void
pack-priv final long
addr(int index)

public ByteBuf
copy(int index, int length)

Overrides io.netty.buffer.UnpooledDirectByteBuf.copy.

Returns a copy of this buffer's sub-region.
public byte
getByte(int index)

Overrides io.netty.buffer.UnpooledDirectByteBuf.getByte.

Gets a byte at the specified absolute index in this buffer.
public ByteBuf
getBytes(int index, ByteBuf dst, int
the first index of the destination
dstIndex
,
int
the number of bytes to transfer
length
)

Overrides io.netty.buffer.UnpooledDirectByteBuf.getBytes.

Transfers this buffer's data to the specified destination starting at the specified absolute index.
pack-priv void
getBytes(int index, byte[] dst, int dstIndex, int length, boolean internal)

Overrides io.netty.buffer.UnpooledDirectByteBuf.getBytes.

pack-priv void
getBytes(int index, ByteBuffer dst, boolean internal)

Overrides io.netty.buffer.UnpooledDirectByteBuf.getBytes.

pack-priv void
getBytes(int index, OutputStream out, int length, boolean internal)

Overrides io.netty.buffer.UnpooledDirectByteBuf.getBytes.

public int
getInt(int index)

Overrides io.netty.buffer.UnpooledDirectByteBuf.getInt.

Gets a 32-bit integer at the specified absolute index in this buffer.
public long
getLong(int index)

Overrides io.netty.buffer.UnpooledDirectByteBuf.getLong.

Gets a 64-bit long integer at the specified absolute index in this buffer.
public short
getShort(int index)

Overrides io.netty.buffer.UnpooledDirectByteBuf.getShort.

Gets a 16-bit short integer at the specified absolute index in this buffer.
public int
getUnsignedMedium(int index)

Overrides io.netty.buffer.UnpooledDirectByteBuf.getUnsignedMedium.

Gets an unsigned 24-bit medium integer at the specified absolute index in this buffer.
public boolean
hasMemoryAddress()

Overrides io.netty.buffer.UnpooledDirectByteBuf.hasMemoryAddress.

Returns true if and only if this buffer has a reference to the low-level memory address that points to the backing data.
public long
memoryAddress()

Overrides io.netty.buffer.UnpooledDirectByteBuf.memoryAddress.

Returns the low-level memory address that point to the first byte of ths backing data.
protected SwappedByteBuf
newSwappedByteBuf()

Overrides io.netty.buffer.AbstractByteBuf.newSwappedByteBuf.

Deprecated as a consequence of SwappedByteBuf being deprecated.
Creates a new SwappedByteBuf for this ByteBuf instance.
public ByteBuf
setByte(int index, int value)

Overrides io.netty.buffer.UnpooledDirectByteBuf.setByte.

Sets the specified byte at the specified absolute index in this buffer.
pack-priv final void
public ByteBuf
setBytes(int index, ByteBuf src, int
the first index of the source
srcIndex
,
int
the number of bytes to transfer
length
)

Overrides io.netty.buffer.UnpooledDirectByteBuf.setBytes.

Transfers the specified source buffer's data to this buffer starting at the specified absolute index.
public ByteBuf
setBytes(int index, byte[] src, int srcIndex, int length)

Overrides io.netty.buffer.UnpooledDirectByteBuf.setBytes.

Transfers the specified source array's data to this buffer starting at the specified absolute index.
public ByteBuf
setBytes(int index, ByteBuffer src)

Overrides io.netty.buffer.UnpooledDirectByteBuf.setBytes.

Transfers the specified source buffer's data to this buffer starting at the specified absolute index until the source buffer's position reaches its limit.
public int
setBytes(int index, InputStream in, int
the number of bytes to transfer
length
)

Overrides io.netty.buffer.UnpooledDirectByteBuf.setBytes.

Transfers the content of the specified source stream to this buffer starting at the specified absolute index.
public ByteBuf
setInt(int index, int value)

Overrides io.netty.buffer.UnpooledDirectByteBuf.setInt.

Sets the specified 32-bit integer at the specified absolute index in this buffer.
public ByteBuf
setLong(int index, long value)

Overrides io.netty.buffer.UnpooledDirectByteBuf.setLong.

Sets the specified 64-bit long integer at the specified absolute index in this buffer.
public ByteBuf
setMedium(int index, int value)

Overrides io.netty.buffer.UnpooledDirectByteBuf.setMedium.

Sets the specified 24-bit medium integer at the specified absolute index in this buffer.
public ByteBuf
setShort(int index, int value)

Overrides io.netty.buffer.UnpooledDirectByteBuf.setShort.

Sets the specified 16-bit short integer at the specified absolute index in this buffer.
public ByteBuf
setZero(int index, int
the number of NULs to write to the buffer
length
)

Overrides io.netty.buffer.AbstractByteBuf.setZero.

Fills this buffer with NUL (0x00) starting at the specified absolute index.
public ByteBuf
writeZero(int
the number of NULs to write to the buffer
length
)

Overrides io.netty.buffer.AbstractByteBuf.writeZero.

Fills this buffer with NUL (0x00) starting at the current writerIndex and increases the writerIndex by the specified length.
Inherited from io.netty.buffer.UnpooledDirectByteBuf:
allocallocateDirectarrayarrayOffsetcapacitycapacitydeallocatefreeDirectgetBytesgetBytesgetBytesgetBytesgetByteshasArrayinternalNioBufferisContiguousisDirectnioBuffernioBufferCountnioBuffersorderreadBytesreadBytesreadBytesreadBytesreadBytessetBytessetBytesunwrap

Field Detail

memoryAddressback to summary
pack-priv long memoryAddress

Constructor Detail

UnpooledUnsafeDirectByteBufback to summary
public UnpooledUnsafeDirectByteBuf(ByteBufAllocator alloc, int initialCapacity, int maxCapacity)

Creates a new direct buffer.

Parameters
initialCapacity:int

the initial capacity of the underlying direct buffer

maxCapacity:int

the maximum capacity of the underlying direct buffer

UnpooledUnsafeDirectByteBufback to summary
protected UnpooledUnsafeDirectByteBuf(ByteBufAllocator alloc, ByteBuffer initialBuffer, int maxCapacity)

Creates a new direct buffer by wrapping the specified initial buffer.

Parameters
maxCapacity:int

the maximum capacity of the underlying direct buffer

UnpooledUnsafeDirectByteBufback to summary
pack-priv UnpooledUnsafeDirectByteBuf(ByteBufAllocator alloc, ByteBuffer initialBuffer, int maxCapacity, boolean doFree)

Method Detail

_getByteback to summary
protected byte _getByte(int index)

Overrides io.netty.buffer.UnpooledDirectByteBuf._getByte.

Annotations
@Override
_getIntback to summary
protected int _getInt(int index)

Overrides io.netty.buffer.UnpooledDirectByteBuf._getInt.

Annotations
@Override
_getIntLEback to summary
protected int _getIntLE(int index)

Overrides io.netty.buffer.UnpooledDirectByteBuf._getIntLE.

Annotations
@Override
_getLongback to summary
protected long _getLong(int index)

Overrides io.netty.buffer.UnpooledDirectByteBuf._getLong.

Annotations
@Override
_getLongLEback to summary
protected long _getLongLE(int index)

Overrides io.netty.buffer.UnpooledDirectByteBuf._getLongLE.

Annotations
@Override
_getShortback to summary
protected short _getShort(int index)

Overrides io.netty.buffer.UnpooledDirectByteBuf._getShort.

Annotations
@Override
_getShortLEback to summary
protected short _getShortLE(int index)

Overrides io.netty.buffer.UnpooledDirectByteBuf._getShortLE.

Annotations
@Override
_getUnsignedMediumback to summary
protected int _getUnsignedMedium(int index)

Overrides io.netty.buffer.UnpooledDirectByteBuf._getUnsignedMedium.

Annotations
@Override
_getUnsignedMediumLEback to summary
protected int _getUnsignedMediumLE(int index)

Overrides io.netty.buffer.UnpooledDirectByteBuf._getUnsignedMediumLE.

Annotations
@Override
_setByteback to summary
protected void _setByte(int index, int value)

Overrides io.netty.buffer.UnpooledDirectByteBuf._setByte.

Annotations
@Override
_setIntback to summary
protected void _setInt(int index, int value)

Overrides io.netty.buffer.UnpooledDirectByteBuf._setInt.

Annotations
@Override
_setIntLEback to summary
protected void _setIntLE(int index, int value)

Overrides io.netty.buffer.UnpooledDirectByteBuf._setIntLE.

Annotations
@Override
_setLongback to summary
protected void _setLong(int index, long value)

Overrides io.netty.buffer.UnpooledDirectByteBuf._setLong.

Annotations
@Override
_setLongLEback to summary
protected void _setLongLE(int index, long value)

Overrides io.netty.buffer.UnpooledDirectByteBuf._setLongLE.

Annotations
@Override
_setMediumback to summary
protected void _setMedium(int index, int value)

Overrides io.netty.buffer.UnpooledDirectByteBuf._setMedium.

Annotations
@Override
_setMediumLEback to summary
protected void _setMediumLE(int index, int value)

Overrides io.netty.buffer.UnpooledDirectByteBuf._setMediumLE.

Annotations
@Override
_setShortback to summary
protected void _setShort(int index, int value)

Overrides io.netty.buffer.UnpooledDirectByteBuf._setShort.

Annotations
@Override
_setShortLEback to summary
protected void _setShortLE(int index, int value)

Overrides io.netty.buffer.UnpooledDirectByteBuf._setShortLE.

Annotations
@Override
addrback to summary
pack-priv final long addr(int index)
copyback to summary
public ByteBuf copy(int index, int length)

Overrides io.netty.buffer.UnpooledDirectByteBuf.copy.

Doc from io.netty.buffer.ByteBuf.copy.

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 modify readerIndex or writerIndex of this buffer.

Annotations
@Override
getByteback to summary
public byte getByte(int index)

Overrides io.netty.buffer.UnpooledDirectByteBuf.getByte.

Doc from io.netty.buffer.ByteBuf.getByte.

Gets a byte at the specified absolute index in this buffer. This method does not modify readerIndex or writerIndex of this buffer.

Annotations
@Override
getBytesback to summary
public ByteBuf getBytes(int index, ByteBuf dst, int dstIndex, int length)

Overrides io.netty.buffer.UnpooledDirectByteBuf.getBytes.

Doc from io.netty.buffer.ByteBuf.getBytes.

Transfers this buffer's data to the specified destination starting at the specified absolute index. This method does not modify readerIndex or writerIndex of both the source (i.e. this) and the destination.

Parameters
dstIndex:int

the first index of the destination

length:int

the number of bytes to transfer

Annotations
@Override
getBytesback to summary
pack-priv void getBytes(int index, byte[] dst, int dstIndex, int length, boolean internal)

Overrides io.netty.buffer.UnpooledDirectByteBuf.getBytes.

Annotations
@Override
getBytesback to summary
pack-priv void getBytes(int index, ByteBuffer dst, boolean internal)

Overrides io.netty.buffer.UnpooledDirectByteBuf.getBytes.

Annotations
@Override
getBytesback to summary
pack-priv void getBytes(int index, OutputStream out, int length, boolean internal) throws IOException

Overrides io.netty.buffer.UnpooledDirectByteBuf.getBytes.

Annotations
@Override
getIntback to summary
public int getInt(int index)

Overrides io.netty.buffer.UnpooledDirectByteBuf.getInt.

Doc from io.netty.buffer.ByteBuf.getInt.

Gets a 32-bit integer at the specified absolute index in this buffer. This method does not modify readerIndex or writerIndex of this buffer.

Annotations
@Override
getLongback to summary
public long getLong(int index)

Overrides io.netty.buffer.UnpooledDirectByteBuf.getLong.

Doc from io.netty.buffer.ByteBuf.getLong.

Gets a 64-bit long integer at the specified absolute index in this buffer. This method does not modify readerIndex or writerIndex of this buffer.

Annotations
@Override
getShortback to summary
public short getShort(int index)

Overrides io.netty.buffer.UnpooledDirectByteBuf.getShort.

Doc from io.netty.buffer.ByteBuf.getShort.

Gets a 16-bit short integer at the specified absolute index in this buffer. This method does not modify readerIndex or writerIndex of this buffer.

Annotations
@Override
getUnsignedMediumback to summary
public int getUnsignedMedium(int index)

Overrides io.netty.buffer.UnpooledDirectByteBuf.getUnsignedMedium.

Doc from io.netty.buffer.ByteBuf.getUnsignedMedium.

Gets an unsigned 24-bit medium integer at the specified absolute index in this buffer. This method does not modify readerIndex or writerIndex of this buffer.

Annotations
@Override
hasMemoryAddressback to summary
public boolean hasMemoryAddress()

Overrides io.netty.buffer.UnpooledDirectByteBuf.hasMemoryAddress.

Doc from io.netty.buffer.ByteBuf.hasMemoryAddress.

Returns true if and only if this buffer has a reference to the low-level memory address that points to the backing data.

Annotations
@Override
memoryAddressback to summary
public long memoryAddress()

Overrides io.netty.buffer.UnpooledDirectByteBuf.memoryAddress.

Doc from io.netty.buffer.ByteBuf.memoryAddress.

Returns the low-level memory address that point to the first byte of ths backing data.

Annotations
@Override
newSwappedByteBufback to summary
protected SwappedByteBuf newSwappedByteBuf()

Overrides io.netty.buffer.AbstractByteBuf.newSwappedByteBuf.

Doc from io.netty.buffer.AbstractByteBuf.newSwappedByteBuf.

Deprecated

as a consequence of SwappedByteBuf being deprecated. See corresponding docs for further information.

Creates a new SwappedByteBuf for this ByteBuf instance.

Annotations
@Override
setByteback to summary
public ByteBuf setByte(int index, int value)

Overrides io.netty.buffer.UnpooledDirectByteBuf.setByte.

Doc from io.netty.buffer.ByteBuf.setByte.

Sets the specified byte at the specified absolute index in this buffer. The 24 high-order bits of the specified value are ignored. This method does not modify readerIndex or writerIndex of this buffer.

Annotations
@Override
setByteBufferback to summary
pack-priv final void setByteBuffer(ByteBuffer buffer, boolean tryFree)

Overrides io.netty.buffer.UnpooledDirectByteBuf.setByteBuffer.

Annotations
@Override
setBytesback to summary
public ByteBuf setBytes(int index, ByteBuf src, int srcIndex, int length)

Overrides io.netty.buffer.UnpooledDirectByteBuf.setBytes.

Doc from io.netty.buffer.ByteBuf.setBytes.

Transfers the specified source buffer's data to this buffer starting at the specified absolute index. This method does not modify readerIndex or writerIndex of both the source (i.e. this) and the destination.

Parameters
srcIndex:int

the first index of the source

length:int

the number of bytes to transfer

Annotations
@Override
setBytesback to summary
public ByteBuf setBytes(int index, byte[] src, int srcIndex, int length)

Overrides io.netty.buffer.UnpooledDirectByteBuf.setBytes.

Doc from io.netty.buffer.ByteBuf.setBytes.

Transfers the specified source array's data to this buffer starting at the specified absolute index. This method does not modify readerIndex or writerIndex of this buffer.

Annotations
@Override
setBytesback to summary
public ByteBuf setBytes(int index, ByteBuffer src)

Overrides io.netty.buffer.UnpooledDirectByteBuf.setBytes.

Doc from io.netty.buffer.ByteBuf.setBytes.

Transfers the specified source buffer's data to this buffer starting at the specified absolute index until the source buffer's position reaches its limit. This method does not modify readerIndex or writerIndex of this buffer.

Annotations
@Override
setBytesback to summary
public int setBytes(int index, InputStream in, int length) throws IOException

Overrides io.netty.buffer.UnpooledDirectByteBuf.setBytes.

Doc from io.netty.buffer.ByteBuf.setBytes.

Transfers the content of the specified source stream to this buffer starting at the specified absolute index. This method does not modify readerIndex or writerIndex of this buffer.

Parameters
length:int

the number of bytes to transfer

Returns:int

the actual number of bytes read in from the specified channel. -1 if the specified InputStream reached EOF.

Annotations
@Override
Exceptions
IOException:
if the specified stream threw an exception during I/O
setIntback to summary
public ByteBuf setInt(int index, int value)

Overrides io.netty.buffer.UnpooledDirectByteBuf.setInt.

Doc from io.netty.buffer.ByteBuf.setInt.

Sets the specified 32-bit integer at the specified absolute index in this buffer. This method does not modify readerIndex or writerIndex of this buffer.

Annotations
@Override
setLongback to summary
public ByteBuf setLong(int index, long value)

Overrides io.netty.buffer.UnpooledDirectByteBuf.setLong.

Doc from io.netty.buffer.ByteBuf.setLong.

Sets the specified 64-bit long integer at the specified absolute index in this buffer. This method does not modify readerIndex or writerIndex of this buffer.

Annotations
@Override
setMediumback to summary
public ByteBuf setMedium(int index, int value)

Overrides io.netty.buffer.UnpooledDirectByteBuf.setMedium.

Doc from io.netty.buffer.ByteBuf.setMedium.

Sets the specified 24-bit medium integer at the specified absolute index in this buffer. Please note that the most significant byte is ignored in the specified value. This method does not modify readerIndex or writerIndex of this buffer.

Annotations
@Override
setShortback to summary
public ByteBuf setShort(int index, int value)

Overrides io.netty.buffer.UnpooledDirectByteBuf.setShort.

Doc from io.netty.buffer.ByteBuf.setShort.

Sets the specified 16-bit short integer at the specified absolute index in this buffer. The 16 high-order bits of the specified value are ignored. This method does not modify readerIndex or writerIndex of this buffer.

Annotations
@Override
setZeroback to summary
public ByteBuf setZero(int index, int length)

Overrides io.netty.buffer.AbstractByteBuf.setZero.

Doc from io.netty.buffer.ByteBuf.setZero.

Fills this buffer with NUL (0x00) starting at the specified absolute index. This method does not modify readerIndex or writerIndex of this buffer.

Parameters
length:int

the number of NULs to write to the buffer

Annotations
@Override
writeZeroback to summary
public ByteBuf writeZero(int length)

Overrides io.netty.buffer.AbstractByteBuf.writeZero.

Doc from io.netty.buffer.ByteBuf.writeZero.

Fills this buffer with NUL (0x00) starting at the current writerIndex and increases the writerIndex by the specified length. If this.writableBytes is less than length, ensureWritable(int) will be called in an attempt to expand capacity to accommodate.

Parameters
length:int

the number of NULs to write to the buffer

Annotations
@Override