public abstract class QueuedHttpInput<T> extends HttpInput<T>
QueuedHttpInput
holds a queue of items passed to it by calls to content(Object)
.
QueuedHttpInput
stores the items directly; if the items contain byte buffers, it does not copy them
but simply holds references to the item, thus the caller must organize for those buffers to valid while
held by this class.
To assist the caller, subclasses may override methods HttpInput.onAsyncRead()
, onContentConsumed(Object)
that can be implemented so that the caller will know when buffers are queued and consumed.
HttpInput.State
Constructor and Description |
---|
QueuedHttpInput() |
Modifier and Type | Method and Description |
---|---|
protected void |
blockForContent()
Blocks until some content or some end-of-file event arrives.
|
void |
content(T item)
Adds some content to this input stream.
|
void |
earlyEOF()
This method should be called to signal that an EOF has been
detected before all the expected content arrived.
|
void |
messageComplete()
This method should be called to signal that all the expected
content arrived.
|
protected T |
nextContent()
Access the next content to be consumed from.
|
protected abstract void |
onContentConsumed(T item)
Callback that signals that the given content has been consumed.
|
void |
recycle() |
available, consume, consumeAll, failed, get, getContentRead, getNextContent, init, isAsync, isEarlyEOF, isEOF, isFinished, isReady, lock, onAsyncRead, read, read, remaining, run, setReadListener, unready
readLine
close, mark, markSupported, read, reset, skip
public void content(T item)
HttpInput
protected T nextContent()
HttpInput
Calls to HttpInput.get(Object, byte[], int, int)
or HttpInput.consume(Object, int)
are required to consume data from the content.
nextContent
in class HttpInput<T>
protected void blockForContent() throws IOException
HttpInput
blockForContent
in class HttpInput<T>
IOException
- if the wait is interruptedprotected abstract void onContentConsumed(T item)
item
- the consumed contentpublic void earlyEOF()
HttpInput
Typically this will result in an EOFException being thrown from a subsequent read rather than a -1 return.
public void messageComplete()
HttpInput
messageComplete
in class HttpInput<T>
Copyright © 1995-2015 Webtide. All Rights Reserved.