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, read
public 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 InputStream
IOException
public int read(byte[] b, int off, int len) throws IOException
read
in class InputStream
IOException
public long skip(long n) throws IOException
skip
in class InputStream
IOException
public void mark(int readlimit)
mark
in class InputStream
public void reset() throws IOException
reset
in class InputStream
IOException
public boolean markSupported()
markSupported
in class InputStream
Copyright © 2001-2014 The Apache Software Foundation. All Rights Reserved.