public interface DataBuffer
DataBuffer
and after the DataBuffer
is full or finished, the appended data can be copied from it in subpartition 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.
Modifier and Type | Method and Description |
---|---|
boolean |
append(ByteBuffer source,
int targetSubpartition,
Buffer.DataType dataType)
Appends data of the specified subpartition to this
DataBuffer and returns true if
this DataBuffer is full. |
void |
finish()
Finishes this
DataBuffer which means no record can be appended anymore. |
BufferWithSubpartition |
getNextBuffer(MemorySegment transitBuffer)
Copies data in this
DataBuffer to the target MemorySegment in subpartition
index order and returns BufferWithSubpartition which contains the copied data and the
corresponding subpartition 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. |
boolean append(ByteBuffer source, int targetSubpartition, Buffer.DataType dataType) throws IOException
DataBuffer
and returns true if
this DataBuffer
is full.IOException
BufferWithSubpartition getNextBuffer(@Nullable MemorySegment transitBuffer)
DataBuffer
to the target MemorySegment
in subpartition
index order and returns BufferWithSubpartition
which contains the copied data and the
corresponding subpartition index.long numTotalRecords()
DataBuffer
.long numTotalBytes()
DataBuffer
.boolean hasRemaining()
DataBuffer
is consumed.void finish()
DataBuffer
which means no record can be appended anymore.boolean isFinished()
DataBuffer
is finished or not.void release()
DataBuffer
which releases all resources.boolean isReleased()
DataBuffer
is released or not.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.