public class NetworkBuffer extends org.apache.flink.shaded.netty4.io.netty.buffer.AbstractReferenceCountedByteBuf implements Buffer
MemorySegment instances.
NOTE: before using this buffer in the netty stack, a buffer allocator must be
set via setAllocator(ByteBufAllocator)!
| Constructor and Description |
|---|
NetworkBuffer(org.apache.flink.core.memory.MemorySegment memorySegment,
BufferRecycler recycler)
Creates a new buffer instance backed by the given memorySegment with 0 for
the readerIndex and writerIndex.
|
NetworkBuffer(org.apache.flink.core.memory.MemorySegment memorySegment,
BufferRecycler recycler,
boolean isBuffer)
Creates a new buffer instance backed by the given memorySegment with 0 for
the readerIndex and writerIndex.
|
NetworkBuffer(org.apache.flink.core.memory.MemorySegment memorySegment,
BufferRecycler recycler,
boolean isBuffer,
boolean isCompressed,
int size)
Creates a new buffer instance backed by the given memorySegment with 0 for
the readerIndex and size as writerIndex.
|
NetworkBuffer(org.apache.flink.core.memory.MemorySegment memorySegment,
BufferRecycler recycler,
boolean isBuffer,
int size)
Creates a new buffer instance backed by the given memorySegment with 0 for
the readerIndex and size as writerIndex.
|
| Modifier and Type | Method and Description |
|---|---|
protected byte |
_getByte(int index) |
protected int |
_getInt(int index) |
protected int |
_getIntLE(int index) |
protected long |
_getLong(int index) |
protected long |
_getLongLE(int index) |
protected short |
_getShort(int index) |
protected short |
_getShortLE(int index) |
protected int |
_getUnsignedMedium(int index) |
protected int |
_getUnsignedMediumLE(int index) |
protected void |
_setByte(int index,
int value) |
protected void |
_setInt(int index,
int value) |
protected void |
_setIntLE(int index,
int value) |
protected void |
_setLong(int index,
long value) |
protected void |
_setLongLE(int index,
long value) |
protected void |
_setMedium(int index,
int value) |
protected void |
_setMediumLE(int index,
int value) |
protected void |
_setShort(int index,
int value) |
protected void |
_setShortLE(int index,
int value) |
org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufAllocator |
alloc() |
byte[] |
array() |
int |
arrayOffset() |
org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf |
asByteBuf() |
int |
capacity() |
org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf |
capacity(int newCapacity) |
org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf |
copy(int index,
int length) |
protected void |
deallocate() |
org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf |
getBytes(int index,
byte[] dst,
int dstIndex,
int length) |
org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf |
getBytes(int index,
ByteBuffer dst) |
org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf |
getBytes(int index,
org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf dst,
int dstIndex,
int length) |
int |
getBytes(int index,
FileChannel out,
long position,
int length) |
int |
getBytes(int index,
GatheringByteChannel out,
int length) |
org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf |
getBytes(int index,
OutputStream out,
int length) |
int |
getMaxCapacity()
Returns the maximum size of the buffer, i.e.
|
org.apache.flink.core.memory.MemorySegment |
getMemorySegment()
Returns the underlying memory segment.
|
int |
getMemorySegmentOffset()
This method will be removed in the future.
|
ByteBuffer |
getNioBuffer(int index,
int length)
Gets a new
ByteBuffer instance wrapping this buffer's bytes. |
ByteBuffer |
getNioBufferReadable()
Gets a new
ByteBuffer instance wrapping this buffer's readable bytes, i.e. |
int |
getReaderIndex()
Returns the reader index of this buffer.
|
BufferRecycler |
getRecycler()
Gets the buffer's recycler.
|
int |
getSize()
Returns the size of the written data, i.e.
|
boolean |
hasArray() |
boolean |
hasMemoryAddress() |
ByteBuffer |
internalNioBuffer(int index,
int length) |
boolean |
isBuffer()
Returns whether this buffer represents a buffer or an event.
|
boolean |
isCompressed() |
boolean |
isDirect() |
boolean |
isRecycled()
Returns whether this buffer has been recycled or not.
|
long |
memoryAddress() |
ByteBuffer |
nioBuffer(int index,
int length) |
int |
nioBufferCount() |
ByteBuffer[] |
nioBuffers(int index,
int length) |
ByteOrder |
order() |
org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf |
readBytes(int length) |
ReadOnlySlicedNetworkBuffer |
readOnlySlice()
Returns a read-only slice of this buffer's readable bytes, i.e.
|
ReadOnlySlicedNetworkBuffer |
readOnlySlice(int index,
int length)
Returns a read-only slice of this buffer.
|
void |
recycleBuffer()
Releases this buffer once, i.e.
|
NetworkBuffer |
retainBuffer()
Retains this buffer for further use, increasing the reference counter by 1.
|
void |
setAllocator(org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufAllocator allocator)
Sets the buffer allocator for use in netty.
|
org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf |
setBytes(int index,
byte[] src,
int srcIndex,
int length) |
org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf |
setBytes(int index,
ByteBuffer src) |
org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf |
setBytes(int index,
org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf src,
int srcIndex,
int length) |
int |
setBytes(int index,
FileChannel in,
long position,
int length) |
int |
setBytes(int index,
InputStream in,
int length) |
int |
setBytes(int index,
ScatteringByteChannel in,
int length) |
void |
setCompressed(boolean isCompressed)
Tags the buffer as compressed or uncompressed.
|
void |
setReaderIndex(int readerIndex)
Sets the reader index of this buffer.
|
void |
setSize(int writerIndex)
Sets the size of the written data, i.e.
|
void |
tagAsEvent()
Tags this buffer to represent an event.
|
String |
toString() |
org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf |
unwrap() |
refCnt, release, release, resetRefCnt, retain, retain, setRefCnt, touch, touchadjustMarkers, asReadOnly, bytesBefore, bytesBefore, bytesBefore, checkDstIndex, checkDstIndex, checkIndex, checkIndex, checkNewCapacity, checkReadableBytes, checkSrcIndex, clear, compareTo, copy, discardReadBytes, discardSomeReadBytes, duplicate, ensureAccessible, ensureWritable, ensureWritable, equals, forEachByte, forEachByte, forEachByteDesc, forEachByteDesc, getBoolean, getByte, getBytes, getBytes, getBytes, getChar, getCharSequence, getDouble, getFloat, getInt, getIntLE, getLong, getLongLE, getMedium, getMediumLE, getShort, getShortLE, getUnsignedByte, getUnsignedInt, getUnsignedIntLE, getUnsignedMedium, getUnsignedMediumLE, getUnsignedShort, getUnsignedShortLE, hashCode, indexOf, isReadable, isReadable, isReadOnly, isWritable, isWritable, markReaderIndex, markWriterIndex, maxCapacity, maxCapacity, maxWritableBytes, newSwappedByteBuf, nioBuffer, nioBuffers, order, readableBytes, readBoolean, readByte, 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, setByte, setBytes, setBytes, setBytes, setChar, setCharSequence, setDouble, setFloat, setIndex, setInt, setIntLE, setLong, setLongLE, setMedium, setMediumLE, setShort, setShortLE, setZero, skipBytes, slice, slice, toString, toString, 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, writeZerogetDoubleLE, getFloatLE, maxFastWritableBytes, readDoubleLE, readFloatLE, setDoubleLE, setFloatLE, writeDoubleLE, writeFloatLEclone, finalize, getClass, notify, notifyAll, wait, wait, waitreadableBytespublic NetworkBuffer(org.apache.flink.core.memory.MemorySegment memorySegment,
BufferRecycler recycler)
memorySegment - backing memory segment (defines AbstractByteBuf.maxCapacity)recycler - will be called to recycle this buffer once the reference count is 0public NetworkBuffer(org.apache.flink.core.memory.MemorySegment memorySegment,
BufferRecycler recycler,
boolean isBuffer)
memorySegment - backing memory segment (defines AbstractByteBuf.maxCapacity)recycler - will be called to recycle this buffer once the reference count is 0isBuffer - whether this buffer represents a buffer (true) or an event (false)public NetworkBuffer(org.apache.flink.core.memory.MemorySegment memorySegment,
BufferRecycler recycler,
boolean isBuffer,
int size)
memorySegment - backing memory segment (defines AbstractByteBuf.maxCapacity)recycler - will be called to recycle this buffer once the reference count is 0isBuffer - whether this buffer represents a buffer (true) or an event (false)size - current size of data in the buffer, i.e. the writer index to setpublic NetworkBuffer(org.apache.flink.core.memory.MemorySegment memorySegment,
BufferRecycler recycler,
boolean isBuffer,
boolean isCompressed,
int size)
memorySegment - backing memory segment (defines AbstractByteBuf.maxCapacity)recycler - will be called to recycle this buffer once the reference count is 0isBuffer - whether this buffer represents a buffer (true) or an event (false)size - current size of data in the buffer, i.e. the writer index to setisCompressed - whether the buffer is compressed or notpublic boolean isBuffer()
Bufferpublic void tagAsEvent()
BuffertagAsEvent in interface Bufferpublic org.apache.flink.core.memory.MemorySegment getMemorySegment()
BufferBuffer.getMemorySegmentOffset().
This method will be removed in the future. For writing use BufferBuilder.
getMemorySegment in interface Bufferpublic int getMemorySegmentOffset()
BufferBufferBuilder.getMemorySegmentOffset in interface BufferBuffer's data start in the underlying memory segment.public BufferRecycler getRecycler()
BuffergetRecycler in interface Bufferpublic void recycleBuffer()
BufferrecycleBuffer in interface BufferBuffer.retainBuffer()public boolean isRecycled()
BufferisRecycled in interface Bufferpublic NetworkBuffer retainBuffer()
BufferretainBuffer in interface BufferBuffer.recycleBuffer()public ReadOnlySlicedNetworkBuffer readOnlySlice()
BufferBuffer.getReaderIndex() and Buffer.getSize().
Reader and writer indices as well as markers are not shared. Reference counters are
shared but the slice is not retained automatically.
readOnlySlice in interface Bufferpublic ReadOnlySlicedNetworkBuffer readOnlySlice(int index, int length)
BufferReader and writer indices as well as markers are not shared. Reference counters are
shared but the slice is not retained automatically.
readOnlySlice in interface Bufferindex - the index to start fromlength - the length of the sliceprotected void deallocate()
deallocate in class org.apache.flink.shaded.netty4.io.netty.buffer.AbstractReferenceCountedByteBufprotected byte _getByte(int index)
_getByte in class org.apache.flink.shaded.netty4.io.netty.buffer.AbstractByteBufprotected short _getShort(int index)
_getShort in class org.apache.flink.shaded.netty4.io.netty.buffer.AbstractByteBufprotected short _getShortLE(int index)
_getShortLE in class org.apache.flink.shaded.netty4.io.netty.buffer.AbstractByteBufprotected int _getUnsignedMedium(int index)
_getUnsignedMedium in class org.apache.flink.shaded.netty4.io.netty.buffer.AbstractByteBufprotected int _getUnsignedMediumLE(int index)
_getUnsignedMediumLE in class org.apache.flink.shaded.netty4.io.netty.buffer.AbstractByteBufprotected int _getInt(int index)
_getInt in class org.apache.flink.shaded.netty4.io.netty.buffer.AbstractByteBufprotected int _getIntLE(int index)
_getIntLE in class org.apache.flink.shaded.netty4.io.netty.buffer.AbstractByteBufprotected long _getLong(int index)
_getLong in class org.apache.flink.shaded.netty4.io.netty.buffer.AbstractByteBufprotected long _getLongLE(int index)
_getLongLE in class org.apache.flink.shaded.netty4.io.netty.buffer.AbstractByteBufprotected void _setByte(int index,
int value)
_setByte in class org.apache.flink.shaded.netty4.io.netty.buffer.AbstractByteBufprotected void _setShort(int index,
int value)
_setShort in class org.apache.flink.shaded.netty4.io.netty.buffer.AbstractByteBufprotected void _setShortLE(int index,
int value)
_setShortLE in class org.apache.flink.shaded.netty4.io.netty.buffer.AbstractByteBufprotected void _setMedium(int index,
int value)
_setMedium in class org.apache.flink.shaded.netty4.io.netty.buffer.AbstractByteBufprotected void _setMediumLE(int index,
int value)
_setMediumLE in class org.apache.flink.shaded.netty4.io.netty.buffer.AbstractByteBufprotected void _setInt(int index,
int value)
_setInt in class org.apache.flink.shaded.netty4.io.netty.buffer.AbstractByteBufprotected void _setIntLE(int index,
int value)
_setIntLE in class org.apache.flink.shaded.netty4.io.netty.buffer.AbstractByteBufprotected void _setLong(int index,
long value)
_setLong in class org.apache.flink.shaded.netty4.io.netty.buffer.AbstractByteBufprotected void _setLongLE(int index,
long value)
_setLongLE in class org.apache.flink.shaded.netty4.io.netty.buffer.AbstractByteBufpublic int capacity()
capacity in class org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufpublic int getMaxCapacity()
BufferMemorySegment.getMaxCapacity in interface Bufferpublic int getReaderIndex()
BufferThis is where readable (unconsumed) bytes start in the backing memory segment.
getReaderIndex in interface BufferMemorySegment
(inclusive))public void setReaderIndex(int readerIndex)
throws IndexOutOfBoundsException
BuffersetReaderIndex in interface BufferIndexOutOfBoundsException - if the index is less than 0 or greater than Buffer.getSize()public int getSize()
BufferThis is where writable bytes start in the backing memory segment.
public void setSize(int writerIndex)
Bufferpublic org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf capacity(int newCapacity)
capacity in class org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufpublic ByteOrder order()
order in class org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufpublic org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf unwrap()
unwrap in class org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufpublic boolean isDirect()
isDirect in class org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufpublic org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf getBytes(int index,
org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf dst,
int dstIndex,
int length)
getBytes in class org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufpublic org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf getBytes(int index,
byte[] dst,
int dstIndex,
int length)
getBytes in class org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufpublic org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf getBytes(int index,
ByteBuffer dst)
getBytes in class org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufpublic org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf getBytes(int index,
OutputStream out,
int length)
throws IOException
getBytes in class org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufIOExceptionpublic int getBytes(int index,
GatheringByteChannel out,
int length)
throws IOException
getBytes in class org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufIOExceptionpublic int getBytes(int index,
FileChannel out,
long position,
int length)
throws IOException
getBytes in class org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufIOExceptionpublic org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf setBytes(int index,
org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf src,
int srcIndex,
int length)
setBytes in class org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufpublic org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf setBytes(int index,
byte[] src,
int srcIndex,
int length)
setBytes in class org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufpublic org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf setBytes(int index,
ByteBuffer src)
setBytes in class org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufpublic int setBytes(int index,
InputStream in,
int length)
throws IOException
setBytes in class org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufIOExceptionpublic int setBytes(int index,
ScatteringByteChannel in,
int length)
throws IOException
setBytes in class org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufIOExceptionpublic int setBytes(int index,
FileChannel in,
long position,
int length)
throws IOException
setBytes in class org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufIOExceptionpublic org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufAllocator alloc()
alloc in class org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufpublic void setAllocator(org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufAllocator allocator)
BuffersetAllocator in interface Bufferallocator - netty buffer allocatorpublic org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf copy(int index,
int length)
copy in class org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufpublic org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf readBytes(int length)
readBytes in class org.apache.flink.shaded.netty4.io.netty.buffer.AbstractByteBufpublic int nioBufferCount()
nioBufferCount in class org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufpublic ByteBuffer getNioBufferReadable()
BufferByteBuffer instance wrapping this buffer's readable bytes, i.e. between
Buffer.getReaderIndex() and Buffer.getSize().
Please note that neither index is updated by the returned buffer.
getNioBufferReadable in interface Bufferpublic ByteBuffer getNioBuffer(int index, int length)
BufferByteBuffer instance wrapping this buffer's bytes.
Please note that neither read nor write index are updated by the returned buffer.
getNioBuffer in interface BufferBuffer.getNioBufferReadable()public ByteBuffer nioBuffer(int index, int length)
nioBuffer in class org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufpublic ByteBuffer internalNioBuffer(int index, int length)
internalNioBuffer in class org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufpublic ByteBuffer[] nioBuffers(int index, int length)
nioBuffers in class org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufpublic boolean hasArray()
hasArray in class org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufpublic byte[] array()
array in class org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufpublic int arrayOffset()
arrayOffset in class org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufpublic boolean hasMemoryAddress()
hasMemoryAddress in class org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufpublic long memoryAddress()
memoryAddress in class org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufpublic String toString()
toString in class org.apache.flink.shaded.netty4.io.netty.buffer.AbstractByteBufpublic org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf asByteBuf()
public boolean isCompressed()
isCompressed in interface Bufferpublic void setCompressed(boolean isCompressed)
BuffersetCompressed in interface BufferCopyright © 2014–2020 The Apache Software Foundation. All rights reserved.