? PeekableInputStream
java.lang.Object
java.io.InputStream
org.apache.commons.io.input.buffer.CircularBufferInputStream
org.apache.commons.io.input.buffer.PeekableInputStream
- ????????:
Closeable
,AutoCloseable
Implements a buffered input stream, which allows to peek into the buffers first bytes. This comes in handy when
manually implementing scanners, lexers, parsers, and the like.
-
????
??????? org.apache.commons.io.input.buffer.CircularBufferInputStream
buffer, bufferSize, in
-
?????
????????PeekableInputStream
(InputStream inputStream) Creates a new instance, which filters the given input stream, and uses a reasonable default buffer size (8192).PeekableInputStream
(InputStream inputStream, int bufferSize) Creates a new instance, which filters the given input stream, and uses the given buffer size. -
????
??????? org.apache.commons.io.input.buffer.CircularBufferInputStream
close, fillBuffer, haveBytes, read, read, read
??????? java.io.InputStream
available, mark, markSupported, nullInputStream, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
???????
-
PeekableInputStream
Creates a new instance, which filters the given input stream, and uses the given buffer size.- ??:
inputStream
- The input stream, which is being buffered.bufferSize
- The size of theCircularByteBuffer
, which is used internally.
-
PeekableInputStream
Creates a new instance, which filters the given input stream, and uses a reasonable default buffer size (8192).- ??:
inputStream
- The input stream, which is being buffered.
-
-
??????
-
peek
Returns whether the next bytes in the buffer are as given bysourceBuffer
. This is equivalent topeek(byte[], int, int)
withoffset
== 0, andlength
==sourceBuffer.length
- ??:
sourceBuffer
- the buffer to compare against- ??:
- true if the next bytes are as given
- ??:
IOException
- Refilling the buffer failed.
-
peek
Returns whether the next bytes in the buffer are as given bysourceBuffer
, {code offset}, andlength
.- ??:
sourceBuffer
- the buffer to compare againstoffset
- the start offsetlength
- the length to compare- ??:
- true if the next bytes in the buffer are as given
- ??:
IOException
- if there is a problem calling fillBuffer()
-