public class SizeLimitInputStream
extends java.io.FilterInputStream
Modifier and Type | Class and Description |
---|---|
class |
SizeLimitInputStream.SizeLimitExceededException
Signals that a size limit has been reach during an I/O operation.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
REVISION |
Constructor and Description |
---|
SizeLimitInputStream(java.io.InputStream in,
long limit)
Constructs a new SizeLimitInputStreamFilter.
|
Modifier and Type | Method and Description |
---|---|
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.
|
public static final java.lang.String REVISION
public SizeLimitInputStream(java.io.InputStream in, long limit)
in
- the InputStream to delegate tolimit
- the number of bytes accepted by the filter before throwing an exceptionpublic int read(byte[] b) throws java.io.IOException
read
in class java.io.FilterInputStream
b
- the buffer into which the data is read, not nulljava.io.IOException
- if an I/O error occursInputStream.read(byte[])
public int read(byte[] b, int off, int len) throws java.io.IOException
read
in class java.io.FilterInputStream
b
- the buffer into which the data is read, not nulloff
- the start offset in the bufferlen
- the maximum number of bytes to readjava.io.IOException
- if an I/O error occursInputStream.read(byte[], int, int)
public int read() throws java.io.IOException
read
in class java.io.FilterInputStream
java.io.IOException
- if an I/O error occursInputStream.read()
public long skip(long length) throws java.io.IOException
skip
in class java.io.FilterInputStream
length
- the number of bytes to skipjava.io.IOException
- if an I/O error occursInputStream.skip(long)
Copyright © 2001-2017 Jalios SA. All Rights Reserved.