-
Method Summary
void
long
Gets the total capacity of this sorter, in bytes.
org.apache.flink.util.MutableObjectIterator<T>
Gets an iterator over all records in this buffer in their logical order.
long
Gets the number of bytes currently occupied in this sorter, records and sort index.
Gets the record at the given logical position.
Gets the record at the given logical position.
boolean
Checks whether the buffer is empty.
void
Resets the sort buffer back to the state where it is empty.
boolean
Writes a given record to this sort buffer.
void
Writes the records in this buffer in their logical order to the given output.
void
Writes a subset of the records in this buffer in their logical order to the given output.
void
-
Method Details
-
reset
void reset()
Resets the sort buffer back to the state where it is empty. All contained data is discarded.
-
isEmpty
boolean isEmpty()
Checks whether the buffer is empty.
- Returns:
- True, if no record is contained, false otherwise.
-
dispose
void dispose()
Disposes the sorter. This method does not release the memory segments used by the sorter.
- Specified by:
dispose in interface org.apache.flink.util.Disposable
-
getCapacity
long getCapacity()
Gets the total capacity of this sorter, in bytes.
- Returns:
- The sorter's total capacity.
-
getOccupancy
long getOccupancy()
Gets the number of bytes currently occupied in this sorter, records and sort index.
- Returns:
- The number of bytes occupied.
-
getRecord
Gets the record at the given logical position.
- Parameters:
logicalPosition - The logical position of the record.
- Throws:
IOException - Thrown, if an exception occurred during deserialization.
-
getRecord
Gets the record at the given logical position.
- Parameters:
reuse - The reuse object to deserialize the record into.
logicalPosition - The logical position of the record.
- Throws:
IOException - Thrown, if an exception occurred during deserialization.
-
write
Writes a given record to this sort buffer. The written record will be appended and take the
last logical position.
- Parameters:
record - The record to be written.
- Returns:
- True, if the record was successfully written, false, if the sort buffer was full.
- Throws:
IOException - Thrown, if an error occurred while serializing the record into the
buffers.
-
getIterator
org.apache.flink.util.MutableObjectIterator<T> getIterator()
Gets an iterator over all records in this buffer in their logical order.
- Returns:
- An iterator returning the records in their logical order.
-
writeToOutput
Writes the records in this buffer in their logical order to the given output.
- Parameters:
output - The output view to write the records to.
- Throws:
IOException - Thrown, if an I/O exception occurred writing to the output view.
-
-
writeToOutput
Writes a subset of the records in this buffer in their logical order to the given output.
- Parameters:
output - The output view to write the records to.
start - The logical start position of the subset.
num - The number of elements to write.
- Throws:
IOException - Thrown, if an I/O exception occurred writing to the output view.