Class BoundedReader
- java.lang.Object
-
- java.io.Reader
-
- org.apache.maven.shared.filtering.BoundedReader
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Readable
public class BoundedReader extends Reader
A reader that imposes a limit to the number of bytes that can be read from an underlying reader, simulating eof when this limit is reached. This stream can typically be used to constrain a client with regard to a readAheadLimit of an underlying stream, to avoid overrunning this limit and hence lose the opportunity do to reset.
-
-
Constructor Summary
Constructors Constructor Description BoundedReader(Reader target, int readAheadLimit)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidmark(int theReadAheadLimit)intread()intread(char[] cbuf, int off, int len)voidreset()
-
-
-
Constructor Detail
-
BoundedReader
public BoundedReader(Reader target, int readAheadLimit) throws IOException
- Parameters:
target-ReaderreadAheadLimit- read ahead limit.- Throws:
IOException- in case of a failure.
-
-
Method Detail
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classReader- Throws:
IOException
-
reset
public void reset() throws IOException- Overrides:
resetin classReader- Throws:
IOException
-
mark
public void mark(int theReadAheadLimit) throws IOException- Overrides:
markin classReader- Throws:
IOException
-
read
public int read() throws IOException- Overrides:
readin classReader- Throws:
IOException
-
read
public int read(char[] cbuf, int off, int len) throws IOException- Specified by:
readin classReader- Throws:
IOException
-
-