info.informatica.io
Class LimitedInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
info.informatica.io.LimitedInputStream
- All Implemented Interfaces:
- Closeable
public class LimitedInputStream
- extends FilterInputStream
An InputStream with resource limit.
This class allows to have control over the amount of bytes flowing through
the stream.
- Version:
- 1.02
- Author:
- amengual at informatica dot info
LimitedInputStream
public LimitedInputStream(InputStream is,
int maxsize)
- Creates a LimitedInputStream with the specified size.
- Parameters:
is - the InputStream.maxsize - the max amount of bytes that this stream is allowed to read.
LimitedInputStream
public LimitedInputStream(InputStream is)
- Creates a LimitedInputStream with the default value of 64 MB.
- Parameters:
is - the InputStream.
write
public int write(OutputStream os)
throws IOException
- Throws:
IOException
getBytesTransferred
public int getBytesTransferred()
read
public int read()
throws IOException
- Overrides:
read in class FilterInputStream
- Throws:
IOException
read
public int read(byte[] b)
throws IOException
- Overrides:
read in class FilterInputStream
- Throws:
IOException
read
public int read(byte[] b,
int off,
int len)
throws IOException
- Overrides:
read in class FilterInputStream
- Throws:
IOException