|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
java.io.FilterInputStream
org.apache.commons.httpclient.ContentLengthInputStream
Cuts the wrapped InputStream off after a specified number of bytes.
Field Summary |
Fields inherited from class java.io.FilterInputStream |
in |
Constructor Summary | |
ContentLengthInputStream(InputStream in,
int contentLength)
Creates a new length limited stream |
Method Summary | |
void |
close()
Reads until the end of the known length of content. |
int |
read()
Read the next byte from the stream |
int |
read(byte[] b)
Read more bytes from the stream. |
int |
read(byte[] b,
int off,
int len)
Does standard InputStream.read(byte[], int, int) behavior, but
also notifies the watcher when the contents have been consumed. |
Methods inherited from class java.io.FilterInputStream |
available, mark, markSupported, reset, skip |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ContentLengthInputStream(InputStream in, int contentLength)
in
- The stream to wrapcontentLength
- The maximum number of bytes that can be read from
the stream. Subsequent read operations will return -1.Method Detail |
public void close() throws IOException
Reads until the end of the known length of content.
Does not close the underlying socket input, but instead leaves it primed to parse the next response.
IOException
- If an IO problem occurs.public int read() throws IOException
IOException
- If an IO problem occursInputStream.read()
public int read(byte[] b, int off, int len) throws IOException
InputStream.read(byte[], int, int)
behavior, but
also notifies the watcher when the contents have been consumed.
b
- The byte array to fill.off
- Start filling at this position.len
- The number of bytes to attempt to read.
IOException
- Should an error occur on the wrapped stream.public int read(byte[] b) throws IOException
b
- The byte array to put the new data in.
IOException
- If an IO problem occursInputStream.read(byte[])
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |