info.informatica.io
Class LimitedReader
java.lang.Object
java.io.Reader
java.io.FilterReader
info.informatica.io.LimitedReader
- All Implemented Interfaces:
- Closeable, Readable
public class LimitedReader
- extends FilterReader
A Reader with resource limit.
This class allows to have control over the amount of bytes flowing through
the Reader.
- Version:
- 1.01
- Author:
- amengual at informatica dot info
|
Constructor Summary |
LimitedReader(Reader re)
Creates a LimitedReader with the default limit of 4 MB. |
LimitedReader(Reader re,
int maxsize)
Creates a LimitedReader with the specified max size. |
LimitedReader
public LimitedReader(Reader re,
int maxsize)
- Creates a LimitedReader with the specified max size.
- Parameters:
re - the Reader.maxsize - the max amount of bytes that this stream is allowed to read.
LimitedReader
public LimitedReader(Reader re)
- Creates a LimitedReader with the default limit of 4 MB.
- Parameters:
re - the Reader.
readAll
public String readAll()
throws IOException
- Throws:
IOException
readAll
public String readAll(int filelen)
throws IOException
- Throws:
IOException
getBytesTransferred
public int getBytesTransferred()
read
public int read()
throws IOException
- Overrides:
read in class FilterReader
- Throws:
IOException
read
public int read(char[] cbuf)
throws IOException
- Overrides:
read in class Reader
- Throws:
IOException
read
public int read(char[] cbuf,
int off,
int len)
throws IOException
- Overrides:
read in class FilterReader
- Throws:
IOException