? BoundedReader
java.lang.Object
java.io.Reader
org.apache.commons.io.input.BoundedReader
- ????????:
Closeable
,AutoCloseable
,Readable
A reader that imposes a limit to the number of characters that can be read from an underlying reader, returning EOF
when this limit is reached, regardless of state of underlying reader.
One use case is to avoid overrunning the readAheadLimit supplied to Reader.mark(int)
, since reading
too many characters removes the ability to do a successful reset.
- ???????:
- 2.5
-
????
-
?????
??? -
????
??????? java.io.Reader
markSupported, nullReader, read, read, ready, skip, transferTo
-
???????
-
BoundedReader
Constructs a bounded reader- ??:
target
- The target stream that will be usedmaxCharsFromTargetReader
- The maximum number of characters that can be read from target
-
-
??????
-
close
Closes the target- ???:
close
????AutoCloseable
- ???:
close
????Closeable
- ???:
close
???Reader
- ??:
IOException
- If an I/O error occurs while calling the underlying reader's close method
-
reset
Resets the target to the latest mark,- ??:
reset
???Reader
- ??:
IOException
- If an I/O error occurs while calling the underlying reader's reset method- ????:
-
mark
marks the target stream- ??:
mark
???Reader
- ??:
readAheadLimit
- The number of characters that can be read while still retaining the ability to do #reset(). Note that this parameter is not validated with respect to maxCharsFromTargetReader. There is no way to pass past maxCharsFromTargetReader, even if this value is greater.- ??:
IOException
- If an I/O error occurs while calling the underlying reader's mark method- ????:
-
read
Reads a single character- ??:
read
???Reader
- ??:
- -1 on EOF or the character read
- ??:
IOException
- If an I/O error occurs while calling the underlying reader's read method- ????:
-
read
Reads into an array- ???:
read
???Reader
- ??:
cbuf
- The buffer to filloff
- The offsetlen
- The number of chars to read- ??:
- the number of chars read
- ??:
IOException
- If an I/O error occurs while calling the underlying reader's read method- ????:
-