public class LimitedInputStream extends InputStream
Content-Length headers. This stream is
unsynchronized.LimitedOutputStream| Constructor and Description |
|---|
LimitedInputStream(InputStream stream,
int lengthLimit)
Constructs a limited input stream.
|
| Modifier and Type | Method and Description |
|---|---|
int |
available()
Calls the wrapped stream.
|
void |
close()
Closes the underlying input stream.
|
void |
mark(int readlimit)
Calls the wrapped stream.
|
boolean |
markSupported()
Calls the wrapped stream.
|
int |
read()
Reads and returns a single byte from this input stream, or -1 if end of
file or the read limit has been encountered.
|
int |
read(byte[] b,
int off,
int len)
Reads up to
len bytes of data from the input stream into
an array of bytes, possibly less if the read limit is reached. |
void |
reset()
Calls the wrapped stream.
|
String |
toString()
Returns a debug string.
|
read, skippublic LimitedInputStream(InputStream stream, int lengthLimit)
stream - Must be non-null.lengthLimit - limit of bytes of input.public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class InputStreamIOExceptionpublic int read(byte[] b,
int off,
int len)
throws IOException
len bytes of data from the input stream into
an array of bytes, possibly less if the read limit is reached.read in class InputStreamIOExceptionpublic int available()
throws IOException
available in class InputStreamIOExceptionpublic boolean markSupported()
markSupported in class InputStreampublic void reset()
throws IOException
reset in class InputStreamIOExceptionpublic void mark(int readlimit)
mark in class InputStreampublic int read()
throws IOException
read in class InputStreamIOExceptionCopyright © 2012. All Rights Reserved.