Class LimitReader
- java.lang.Object
-
- java.io.Reader
-
- org.apache.derby.iapi.services.io.LimitReader
-
-
Field Summary
Fields Modifier and Type Field Description private booleanlimitInPlaceprivate java.io.Readerreaderprivate intremainingCharacters
-
Constructor Summary
Constructors Constructor Description LimitReader(java.io.Reader reader)Construct a LimitReader and call the clearLimit() method.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intclearLimit()Clear any limit set by setLimit.voidclose()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)
-
-
-
Method Detail
-
read
public int read() throws java.io.IOException- Overrides:
readin classjava.io.Reader- Throws:
java.io.IOException
-
read
public int read(char[] c, int off, int len) throws java.io.IOException- Specified by:
readin classjava.io.Reader- Throws:
java.io.IOException
-
skip
public long skip(long count) throws java.io.IOException- Overrides:
skipin classjava.io.Reader- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein classjava.io.Reader- Throws:
java.io.IOException
-
setLimit
public void setLimit(int length)
Set the limit of the stream that can be read. After this call up to and including length characters can be read from or skipped in the stream. Any attempt to read more than length characters will result in an EOFException
-
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.
-
-