|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.InputStream java.io.FilterInputStream com.jalios.io.SizeLimitInputStream
public class SizeLimitInputStream
InputStream Filter that will throw an SizeLimitExceededException if the wrapped stream exceed the byte count specified in constructor.
Nested Class Summary | |
---|---|
class |
SizeLimitInputStream.SizeLimitExceededException
Signals that a size limit has been reach during an I/O operation. |
Field Summary | |
---|---|
static String |
REVISION
|
Fields inherited from class java.io.FilterInputStream |
---|
in |
Constructor Summary | |
---|---|
SizeLimitInputStream(InputStream in,
long limit)
Constructs a new SizeLimitInputStreamFilter. |
Method Summary | |
---|---|
int |
read()
Reads the next byte of data adding to the count of bytes received if a byte is successfully read. |
int |
read(byte[] b)
Reads a number of bytes into the byte array, keeping count of the number read. |
int |
read(byte[] b,
int off,
int len)
Reads a number of bytes into the byte array at a specific offset, keeping count of the number read. |
long |
skip(long length)
Skips the stream over the specified number of bytes, adding the skipped amount to the count. |
Methods inherited from class java.io.FilterInputStream |
---|
available, close, mark, markSupported, reset |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String REVISION
Constructor Detail |
---|
public SizeLimitInputStream(InputStream in, long limit)
in
- the InputStream to delegate tolimit
- the number of bytes accepted by the filter before throwing an exceptionMethod Detail |
---|
public int read(byte[] b) throws IOException
read
in class FilterInputStream
b
- the buffer into which the data is read, not null
IOException
- if an I/O error occursInputStream.read(byte[])
public int read(byte[] b, int off, int len) throws IOException
read
in class FilterInputStream
b
- the buffer into which the data is read, not nulloff
- the start offset in the bufferlen
- the maximum number of bytes to read
IOException
- if an I/O error occursInputStream.read(byte[], int, int)
public int read() throws IOException
read
in class FilterInputStream
IOException
- if an I/O error occursInputStream.read()
public long skip(long length) throws IOException
skip
in class FilterInputStream
length
- the number of bytes to skip
IOException
- if an I/O error occursInputStream.skip(long)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |