public class ReadableChunkedChannel extends ReadableBufferedChannel
Constructor and Description |
---|
ReadableChunkedChannel(CompletionListener completionListener,
Buffer buffer,
ReadableSelectionChannel source,
WakeupListener wakeupListener)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
clearLineBuilder()
Clears the line builder and adjust its state.
|
protected ChunkState |
getChunkState()
Returns the chunk state.
|
protected StringBuilder |
getLineBuilder()
Returns the line builder to parse chunk size or trailer.
|
protected BufferState |
getLineBuilderState()
Returns the line builder state.
|
protected int |
getRemainingChunkSize()
Returns the remaining chunk size that should be read from the source
channel.
|
int |
onDrain(Buffer buffer,
int maxDrained,
Object... args)
Drains the byte buffer.
|
protected void |
setChunkState(ChunkState chunkState)
Sets the chunk state.
|
protected void |
setLineBuilderState(BufferState lineBuilderState)
Sets the line builder state.
|
protected void |
setRemainingChunkSize(int remainingChunkSize)
Sets the remaining chunk size that should be read from the source
channel.
|
couldDrain, couldFill, isEndReached, onFill, onMessageCompleted, read, setEndReached
canLoop, close, getBuffer, onFillEof, postProcess, preProcess
getRegistration, isBlocking, setRegistration, toString
getWrappedChannel, isOpen
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getRegistration
isBlocking
public ReadableChunkedChannel(CompletionListener completionListener, Buffer buffer, ReadableSelectionChannel source, WakeupListener wakeupListener)
completionListener
- The listener to callback upon reading completion.buffer
- The source byte buffer, typically remaining from previous read
processing.source
- The source channel.wakeupListener
- The wakeup listener that will be notified.protected void clearLineBuilder()
protected ChunkState getChunkState()
protected StringBuilder getLineBuilder()
protected BufferState getLineBuilderState()
protected int getRemainingChunkSize()
public int onDrain(Buffer buffer, int maxDrained, Object... args) throws IOException
onDrain
in interface BufferProcessor
onDrain
in class ReadableBufferedChannel
buffer
- The IO buffer to drain.maxDrained
- The maximum number of bytes drained by this call.args
- The optional arguments to pass back to the callbacks.IOException
protected void setChunkState(ChunkState chunkState)
chunkState
- The chunk state.protected void setLineBuilderState(BufferState lineBuilderState)
lineBuilderState
- The line builder state.protected void setRemainingChunkSize(int remainingChunkSize)
remainingChunkSize
- The remaining chunk size that should be read from the source
channel.Copyright © 2005–2014. All rights reserved.