Package org.apache.xmlrpc.util
Class LimitedInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.apache.xmlrpc.util.LimitedInputStream
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class LimitedInputStream extends InputStream
A filteringInputStream
for proper handling of theContent-Length
header: It guarantees to return at most a given number of bytes.
-
-
Constructor Summary
Constructors Constructor 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
mark(int readlimit)
boolean
markSupported()
int
read()
int
read(byte[] b, int off, int len)
void
reset()
long
skip(long n)
-
Methods inherited from class java.io.InputStream
available, close, nullInputStream, read, readAllBytes, readNBytes, readNBytes, transferTo
-
-
-
-
Constructor Detail
-
LimitedInputStream
public LimitedInputStream(InputStream pIn, int pAvailable)
Creates a new instance, reading from the given input stream and returning at most the given number of bytes.- Parameters:
pIn
- Input stream being read.pAvailable
- Number of bytes available inpIn
.
-
-
Method Detail
-
read
public int read() throws IOException
- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOException
- Overrides:
read
in classInputStream
- Throws:
IOException
-
skip
public long skip(long n) throws IOException
- Overrides:
skip
in classInputStream
- Throws:
IOException
-
mark
public void mark(int readlimit)
- Overrides:
mark
in classInputStream
-
reset
public void reset() throws IOException
- Overrides:
reset
in classInputStream
- Throws:
IOException
-
markSupported
public boolean markSupported()
- Overrides:
markSupported
in classInputStream
-
-