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.
Modifier and Type | Method and Description |
---|---|
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 anymore. |
BufferWithChannel |
getNextBuffer(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. |
boolean append(ByteBuffer source, int targetChannel, Buffer.DataType dataType) throws IOException
DataBuffer
and returns true if this
DataBuffer
is full.IOException
BufferWithChannel getNextBuffer(@Nullable 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 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.