public class CycleResultsRLEBufferTarget extends Object implements Output, CanFilterResultValue
AutoCloseable method to ensure that
partial runs are flushed automatically. Access the buffer for read via either
the toByteBuffer() or the toSegmentsReadable() methods will
automatically flush() and invalidate the writable buffer, so further writes
will be deemed invalid and will cause an exception to be thrown.| Modifier and Type | Field and Description |
|---|---|
static int |
BYTES |
| Constructor and Description |
|---|
CycleResultsRLEBufferTarget(ByteBuffer buf)
Create a buffer with the provided ByteBuffer.
|
CycleResultsRLEBufferTarget(int elementCount)
Create a target RLE buffer for the specified getCount in memory,
rounded to the nearest record getCount.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
int |
getRawBufferCapacity() |
int |
getRecordCapacity() |
boolean |
onCycleResult(CycleResult cycleResult) |
boolean |
onCycleResult(long cycle,
int result)
Record new cycle result data in the buffer, and optionally flush any
completed RLE segments to the internal ByteBuffer.
|
void |
setFilter(Predicate<ResultReadable> filter) |
ByteBuffer |
toByteBuffer() |
CycleResultsRLEBufferReadable |
toSegmentsReadable()
Convert the contents of this RLE buffer to a readable and
invalide it for writing.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitonCycleResultSegmentpublic static final int BYTES
public CycleResultsRLEBufferTarget(ByteBuffer buf)
buf - the source datapublic CycleResultsRLEBufferTarget(int elementCount)
elementCount - The number of elements to buffer.public CycleResultsRLEBufferReadable toSegmentsReadable()
public ByteBuffer toByteBuffer()
public boolean onCycleResult(long cycle,
int result)
onCycleResult in interface Outputcycle - The cycle number being marked.result - the result ordinalRuntimeException - if the buffer has been converted to a readable formpublic int getRawBufferCapacity()
public int getRecordCapacity()
public void close()
close in interface Outputclose in interface AutoCloseablepublic boolean onCycleResult(CycleResult cycleResult)
onCycleResult in interface Outputpublic void setFilter(Predicate<ResultReadable> filter)
setFilter in interface CanFilterResultValueCopyright © 2017. All rights reserved.