public class AsyncLineJoiner extends AsyncAgent
WhenReady
,
AsyncAgent
,
CharRingBuffer
,
StringRingBuffer
Constructor and Description |
---|
AsyncLineJoiner(StringRingBuffer stringRingBuffer,
CharRingBuffer charRingBuffer,
LineAsyncOptions lineAsyncOptions)
Constructs an AsyncLineJoiner 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 written.
|
StringRingBuffer |
getStringRingBuffer()
Returns the attached string ring buffer where lines will be read from.
|
boolean |
isEOF()
Checks whether this line joiner has reached EOF of the input string ring buffer.
|
protected boolean |
ready()
"ready" predicate that returns true when lines can be read from the input
string ring buffer and chars can be written to the output char ring buffer without blocking.
|
applyAsync, isIdle, setIdle, setIdleAndThrow, startApplyLoopAsync
public AsyncLineJoiner(StringRingBuffer stringRingBuffer, CharRingBuffer charRingBuffer, LineAsyncOptions lineAsyncOptions)
stringRingBuffer
- StringRingBuffer
to read lines from.charRingBuffer
- CharRingBuffer
to write chars to.lineAsyncOptions
- LineAsyncOptions
to use for all async operations.public StringRingBuffer getStringRingBuffer()
public CharRingBuffer getCharRingBuffer()
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