public interface DataBuffer
DataBuffer and after the DataBuffer is full or finished, the appended data can be copied from it in channel index order.
The lifecycle of a DataBuffer can be: new, write, [read, reset, write], finish, read,
release. There can be multiple [read, reset, write] operations before finish.
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
append(ByteBuffer source,
int targetChannel,
Buffer.DataType dataType)
Appends data of the specified channel to this
DataBuffer and returns true if this
DataBuffer is full. |
void |
finish()
Finishes this
DataBuffer which means no record can be appended any more. |
BufferWithChannel |
getNextBuffer(org.apache.flink.core.memory.MemorySegment transitBuffer)
Copies data in this
DataBuffer to the target MemorySegment in channel index
order and returns BufferWithChannel which contains the copied data and the
corresponding channel index. |
boolean |
hasRemaining()
Returns true if not all data appended to this
DataBuffer is consumed. |
boolean |
isFinished()
Whether this
DataBuffer is finished or not. |
boolean |
isReleased()
Whether this
DataBuffer is released or not. |
long |
numTotalBytes()
Returns the total number of bytes written to this
DataBuffer. |
long |
numTotalRecords()
Returns the total number of records written to this
DataBuffer. |
void |
release()
Releases this
DataBuffer which releases all resources. |
void |
reset()
Resets this
DataBuffer to be reused for data appending. |
boolean append(ByteBuffer source, int targetChannel, Buffer.DataType dataType) throws IOException
DataBuffer and returns true if this
DataBuffer is full.IOExceptionBufferWithChannel getNextBuffer(@Nullable org.apache.flink.core.memory.MemorySegment transitBuffer)
DataBuffer to the target MemorySegment in channel index
order and returns BufferWithChannel which contains the copied data and the
corresponding channel index.long numTotalRecords()
DataBuffer.long numTotalBytes()
DataBuffer.boolean hasRemaining()
DataBuffer is consumed.void reset()
DataBuffer to be reused for data appending.void finish()
DataBuffer which means no record can be appended any more.boolean isFinished()
DataBuffer is finished or not.void release()
DataBuffer which releases all resources.boolean isReleased()
DataBuffer is released or not.Copyright © 2014–2022 The Apache Software Foundation. All rights reserved.