public abstract class HttpInput<T> extends ServletInputStream
HttpInput
provides an implementation of ServletInputStream
for HttpChannel
.
HttpInput
holds a queue of items passed to it by calls to #content(T)
.
HttpInput
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 #onContentQueued(T)
,
#onContentConsumed(T)
and onAllContentConsumed()
that can be implemented so that the
caller will know when buffers are queued and consumed.
Constructor and Description |
---|
HttpInput() |
Modifier and Type | Method and Description |
---|---|
int |
available() |
protected void |
blockForContent() |
void |
consumeAll() |
boolean |
content(T item) |
void |
earlyEOF() |
protected abstract int |
get(T item,
byte[] buffer,
int offset,
int length) |
boolean |
isEarlyEOF() |
boolean |
isShutdown() |
Object |
lock() |
protected void |
onAllContentConsumed() |
protected abstract void |
onContentConsumed(T item) |
protected void |
onContentQueued(T item) |
protected void |
onEOF() |
int |
read() |
int |
read(byte[] b,
int off,
int len) |
void |
recycle() |
protected abstract int |
remaining(T item) |
void |
shutdown() |
readLine
close, mark, markSupported, read, reset, skip
public Object lock()
public void recycle()
public int read() throws IOException
read
in class InputStream
IOException
public int available()
available
in class InputStream
public int read(byte[] b, int off, int len) throws IOException
read
in class InputStream
IOException
protected abstract int remaining(T item)
protected abstract int get(T item, byte[] buffer, int offset, int length)
protected abstract void onContentConsumed(T item)
protected void blockForContent() throws IOException
IOException
protected void onContentQueued(T item)
protected void onAllContentConsumed()
protected void onEOF()
public boolean content(T item)
public void earlyEOF()
public boolean isEarlyEOF()
public void shutdown()
public boolean isShutdown()
public void consumeAll()
Copyright © 1995-2012 Mort Bay Consulting. All Rights Reserved.