public class BoundedInputStream extends InputStream
This relies on IOUtils' skip and read to try to fully read/skip inputstream.
| Constructor and Description |
|---|
BoundedInputStream(long max,
InputStream in) |
| Modifier and Type | Method and Description |
|---|---|
int |
available() |
boolean |
hasHitBound() |
void |
mark(int readLimit) |
boolean |
markSupported() |
int |
read() |
int |
read(byte[] b)
Invokes the delegate's
read(byte[]) method. |
int |
read(byte[] b,
int off,
int len)
Invokes the delegate's
read(byte[], int, int) method. |
void |
reset() |
long |
skip(long n)
Invokes the delegate's
skip(long) method. |
closepublic BoundedInputStream(long max,
InputStream in)
public int read()
throws IOException
read in class InputStreamIOExceptionpublic int read(byte[] b)
throws IOException
read(byte[]) method.read in class InputStreamb - the buffer to read the bytes intoIOException - if an I/O error occurspublic int read(byte[] b,
int off,
int len)
throws IOException
read(byte[], int, int) method.
This does not have the same guarantees as IOUtil's readFully()...be careful.
read in class InputStreamb - the buffer to read the bytes intooff - The start offsetlen - The number of bytes to readIOException - if an I/O error occurspublic long skip(long n)
throws IOException
skip(long) method.
As with InputStream generally, this does not guarantee reading n bytes.
Use IOUtils' skipFully for that functionality.skip in class InputStreamn - the number of bytes to skipIOException - if an I/O error occurspublic void reset()
throws IOException
reset in class InputStreamIOExceptionpublic void mark(int readLimit)
mark in class InputStreampublic boolean hasHitBound()
public int available()
throws IOException
available in class InputStreamIOExceptionpublic boolean markSupported()
markSupported in class InputStreamCopyright © 2007–2024 The Apache Software Foundation. All rights reserved.