public class AsyncLineSplitter extends AsyncAgent
WhenReady
,
AsyncAgent
,
CharRingBuffer
,
StringRingBuffer
Constructor and Description |
---|
AsyncLineSplitter(CharRingBuffer charRingBuffer,
StringRingBuffer stringRingBuffer,
LineAsyncOptions lineAsyncOptions)
Constructs an AsyncLineSpliter instance over the given ring buffers.
|
Modifier and Type | Method and Description |
---|---|
protected void |
action()
"action" function that reads chars from the input char ring buffer and writes lines to the output string ring buffer.
|
protected boolean |
done()
"done" predicate that returns true when this async agent wants to quit the current async loop.
|
CharRingBuffer |
getCharRingBuffer()
Returns the attached char ring buffer from where chars will be read from.
|
StringRingBuffer |
getStringRingBuffer()
Returns the attached string ring buffer where lines will be written.
|
boolean |
isEOF()
Checks whether this line splitter has reached EOF of the input char ring buffer.
|
protected boolean |
ready()
"ready" predicate that returns true when chars can be read from the input
char ring buffer and lines can be written to the output string ring buffer without blocking.
|
applyAsync, isIdle, setIdle, setIdleAndThrow, startApplyLoopAsync
public AsyncLineSplitter(CharRingBuffer charRingBuffer, StringRingBuffer stringRingBuffer, LineAsyncOptions lineAsyncOptions)
charRingBuffer
- CharRingBuffer
to read chars from.stringRingBuffer
- StringRingBuffer
to write lines to.lineAsyncOptions
- LineAsyncOptions
to use for all async operations.public CharRingBuffer getCharRingBuffer()
public StringRingBuffer getStringRingBuffer()
public boolean isEOF()
protected boolean ready()
ready
in class AsyncAgent
AsyncAgent.action()
.protected boolean done()
done
in class AsyncAgent
protected void action()
action
in class AsyncAgent