Class LimitReader
java.lang.Object
java.io.Reader
org.apache.derby.iapi.services.io.LimitReader
- All Implemented Interfaces:
Closeable, AutoCloseable, Readable, Limit
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionLimitReader(Reader reader) Construct a LimitReader and call the clearLimit() method. -
Method Summary
Modifier and TypeMethodDescriptionintClear any limit set by setLimit.voidclose()final intgetLimit()return limit of the stream that can be read without throwing EOFExceptionintread()intread(char[] c, int off, int len) voidsetLimit(int length) Set the limit of the stream that can be read.longskip(long count) Methods inherited from class Reader
mark, markSupported, nullReader, of, read, read, readAllAsString, readAllLines, ready, reset, transferTo
-
Field Details
-
remainingCharacters
private int remainingCharacters -
limitInPlace
private boolean limitInPlace -
reader
-
-
Constructor Details
-
LimitReader
Construct a LimitReader and call the clearLimit() method.
-
-
Method Details
-
read
- Overrides:
readin classReader- Throws:
IOException
-
read
- Specified by:
readin classReader- Throws:
IOException
-
skip
- Overrides:
skipin classReader- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classReader- Throws:
IOException
-
setLimit
-
getLimit
public final int getLimit()return limit of the stream that can be read without throwing EOFException- Returns:
- the remaining characters left to be read from the stream
-
clearLimit
public int clearLimit()Clear any limit set by setLimit. After this call no limit checking will be made on any read until a setLimit()) call is made.- Specified by:
clearLimitin interfaceLimit- Returns:
- the number of bytes within the limit that have not been read. -1 if not limit was set.
-