public final class ReadOnlySlicedNetworkBuffer extends org.apache.flink.shaded.netty4.io.netty.buffer.ReadOnlyByteBuf implements Buffer
Buffer
implementation wrapping a NetworkBuffer
's sub-region based on io.netty.buffer.SlicedByteBuf and
io.netty.buffer.ReadOnlyByteBuf.
BEWARE: We do not guarantee to block every operation that is able to write data but all returned data structures should be handled as if it was!.
Buffer.DataType
Modifier and Type | Method and Description |
---|---|
org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf |
asByteBuf() |
org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf |
ensureWritable(int minWritableBytes) |
Buffer.DataType |
getDataType()
Gets the type of data this buffer represents.
|
int |
getMaxCapacity()
Returns the maximum size of the buffer, i.e.
|
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 |
isBuffer()
Returns whether this buffer represents a buffer or an event.
|
boolean |
isCompressed() |
boolean |
isRecycled()
Returns whether this buffer has been recycled or not.
|
boolean |
isWritable() |
boolean |
isWritable(int numBytes) |
ByteBuffer |
nioBuffer(int index,
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.
|
ReadOnlySlicedNetworkBuffer |
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.
|
void |
setCompressed(boolean isCompressed)
Tags the buffer as compressed or uncompressed.
|
void |
setDataType(Buffer.DataType dataType)
Sets the type of data this buffer represents.
|
void |
setReaderIndex(int readerIndex)
Sets the reader index of this buffer.
|
void |
setSize(int writerIndex)
Sets the size of the written data, i.e.
|
org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf |
unwrap() |
_getByte, _getInt, _getIntLE, _getLong, _getLongLE, _getShort, _getShortLE, _getUnsignedMedium, _getUnsignedMediumLE, _setByte, _setInt, _setIntLE, _setLong, _setLongLE, _setMedium, _setMediumLE, _setShort, _setShortLE, alloc, array, arrayOffset, asReadOnly, capacity, capacity, copy, discardReadBytes, duplicate, ensureWritable, forEachByte, forEachByteDesc, getByte, getBytes, getBytes, getBytes, getBytes, getBytes, getBytes, getInt, getIntLE, getLong, getLongLE, getShort, getShortLE, getUnsignedMedium, getUnsignedMediumLE, hasArray, hasMemoryAddress, isDirect, isReadOnly, memoryAddress, nioBufferCount, nioBuffers, order, setByte, setBytes, setBytes, setBytes, setBytes, setBytes, setBytes, setInt, setIntLE, setLong, setLongLE, setMedium, setMediumLE, setShort, setShortLE, slice
internalNioBuffer, isContiguous, refCnt, release, release, retain, retain, touch, touch
adjustMarkers, bytesBefore, bytesBefore, bytesBefore, checkDstIndex, checkDstIndex, checkIndex, checkIndex, checkNewCapacity, checkReadableBytes, checkSrcIndex, clear, compareTo, copy, discardSomeReadBytes, ensureAccessible, equals, forEachByte, forEachByteDesc, 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, 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
getDoubleLE, getFloatLE, maxFastWritableBytes, readDoubleLE, readFloatLE, setDoubleLE, setFloatLE, writeDoubleLE, writeFloatLE
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
readableBytes, refCnt, toDebugString
public org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf unwrap()
unwrap
in class org.apache.flink.shaded.netty4.io.netty.buffer.ReadOnlyByteBuf
public boolean isBuffer()
Buffer
public MemorySegment getMemorySegment()
BEWARE: Although we cannot set the memory segment read-only it should be handled as if it was!.
getMemorySegment
in interface Buffer
public int getMemorySegmentOffset()
Buffer
BufferBuilder
.getMemorySegmentOffset
in interface Buffer
Buffer
's data start in the underlying
memory segment.public BufferRecycler getRecycler()
Buffer
getRecycler
in interface Buffer
public void recycleBuffer()
Buffer
recycleBuffer
in interface Buffer
Buffer.retainBuffer()
public boolean isRecycled()
Buffer
isRecycled
in interface Buffer
public ReadOnlySlicedNetworkBuffer retainBuffer()
Buffer
retainBuffer
in interface Buffer
Buffer.recycleBuffer()
public ReadOnlySlicedNetworkBuffer readOnlySlice()
Buffer
Buffer.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 Buffer
public ReadOnlySlicedNetworkBuffer readOnlySlice(int index, int length)
Buffer
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 Buffer
index
- the index to start fromlength
- the length of the slicepublic int getMaxCapacity()
Buffer
MemorySegment
.getMaxCapacity
in interface Buffer
public int getReaderIndex()
Buffer
This is where readable (unconsumed) bytes start in the backing memory segment.
getReaderIndex
in interface Buffer
MemorySegment
(inclusive))public void setReaderIndex(int readerIndex) throws IndexOutOfBoundsException
Buffer
setReaderIndex
in interface Buffer
IndexOutOfBoundsException
- if the index is less than 0 or greater than Buffer.getSize()
public int getSize()
Buffer
This is where writable bytes start in the backing memory segment.
getSize
in interface Buffer
MemorySegment
(inclusive))public void setSize(int writerIndex)
Buffer
public ByteBuffer getNioBufferReadable()
Buffer
ByteBuffer
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 Buffer
public ByteBuffer getNioBuffer(int index, int length) throws IndexOutOfBoundsException
Buffer
ByteBuffer
instance wrapping this buffer's bytes.
Please note that neither read nor write index are updated by the returned buffer.
getNioBuffer
in interface Buffer
IndexOutOfBoundsException
- if the indexes are not without the buffer's boundsBuffer.getNioBufferReadable()
public ByteBuffer nioBuffer(int index, int length)
nioBuffer
in class org.apache.flink.shaded.netty4.io.netty.buffer.ReadOnlyByteBuf
public boolean isWritable()
isWritable
in class org.apache.flink.shaded.netty4.io.netty.buffer.ReadOnlyByteBuf
public boolean isWritable(int numBytes)
isWritable
in class org.apache.flink.shaded.netty4.io.netty.buffer.ReadOnlyByteBuf
public org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf ensureWritable(int minWritableBytes)
ensureWritable
in class org.apache.flink.shaded.netty4.io.netty.buffer.ReadOnlyByteBuf
public void setAllocator(org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufAllocator allocator)
Buffer
setAllocator
in interface Buffer
allocator
- netty buffer allocatorpublic org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf asByteBuf()
public boolean isCompressed()
isCompressed
in interface Buffer
public void setCompressed(boolean isCompressed)
Buffer
setCompressed
in interface Buffer
public Buffer.DataType getDataType()
Buffer
getDataType
in interface Buffer
public void setDataType(Buffer.DataType dataType)
Buffer
setDataType
in interface Buffer
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.