|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
things.data.processing.http.LimitedInputStream
public class LimitedInputStream
Allow it to only read so many bytes.
EPG - New - 12 FEB 2007
Constructor Summary | |
---|---|
LimitedInputStream(java.io.InputStream source,
long limit)
Constructor. |
Method Summary | |
---|---|
int |
available()
Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking by the next invocation of a method for this input stream. |
void |
close()
Close the stream. |
int |
read()
Reads the next byte of data from the input stream. |
int |
read(byte[] b)
Reads some number of bytes from the input stream and stores them into the buffer array b. |
int |
read(byte[] b,
int off,
int len)
Reads up to len bytes of data from the input stream into an array of bytes. |
Methods inherited from class java.io.InputStream |
---|
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 LimitedInputStream(java.io.InputStream source, long limit) throws java.lang.Throwable
source
- stream. It will NOT be closed (even with the close method). You need to close it when you are done.limit
- the limit in bytes.
java.lang.Throwable
- if the stream is null or the limit is less than 1.Method Detail |
---|
public int read() throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
- if an I/O error occurs.public int read(byte[] b, int off, int len) throws java.io.IOException
read
in class java.io.InputStream
b
- the buffer into which the data is read.off
- the start offset in array b at which the data is written.len
- the maximum number of bytes to read.
If
- the first byte cannot be read for any reason other than end of file or if some other I/O error occurs.
java.io.IOException
public int read(byte[] b) throws java.io.IOException
read
in class java.io.InputStream
b
- the buffer into which the data is read.
If
- the first byte cannot be read for any reason other than end of file or if some other I/O error occurs.
java.io.IOException
public int available() throws java.io.IOException
available
in class java.io.InputStream
IO
- exception
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in class java.io.InputStream
java.io.IOException
- All subsequent calls to the reads will result in EOF.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |