public class LimitedInputStream extends InputStream
InputStream for proper handling of
the Content-Length header: It guarantees to return
at most a given number of bytes.| Constructor and Description |
|---|
LimitedInputStream(InputStream pIn,
int pAvailable)
Creates a new instance, reading from the given input stream
and returning at most the given number of bytes.
|
| Modifier and Type | Method and Description |
|---|---|
void |
mark(int readlimit) |
boolean |
markSupported() |
int |
read() |
int |
read(byte[] b,
int off,
int len) |
void |
reset() |
long |
skip(long n) |
available, close, readpublic LimitedInputStream(InputStream pIn, int pAvailable)
pIn - Input stream being read.pAvailable - Number of bytes available in pIn.public int read()
throws IOException
read in class InputStreamIOExceptionpublic int read(byte[] b,
int off,
int len)
throws IOException
read in class InputStreamIOExceptionpublic long skip(long n)
throws IOException
skip in class InputStreamIOExceptionpublic void mark(int readlimit)
mark in class InputStreampublic void reset()
throws IOException
reset in class InputStreamIOExceptionpublic boolean markSupported()
markSupported in class InputStreamCopyright © 2001-2015 The Apache Software Foundation. All Rights Reserved.