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 filteringInputStreamfor proper handling of theContent-Lengthheader: 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 voidmark(int readlimit)booleanmarkSupported()intread()intread(byte[] b, int off, int len)voidreset()longskip(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:
readin classInputStream- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOException- Overrides:
readin classInputStream- Throws:
IOException
-
skip
public long skip(long n) throws IOException- Overrides:
skipin classInputStream- Throws:
IOException
-
mark
public void mark(int readlimit)
- Overrides:
markin classInputStream
-
reset
public void reset() throws IOException- Overrides:
resetin classInputStream- Throws:
IOException
-
markSupported
public boolean markSupported()
- Overrides:
markSupportedin classInputStream
-
-