public class PeekableInputStream extends CircularBufferInputStream
buffer, bufferSize, in
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
boolean |
peek(byte[] sourceBuffer)
Returns, whether the next bytes in the buffer are as given by
sourceBuffer . |
boolean |
peek(byte[] sourceBuffer,
int offset,
int length)
Returns, whether the next bytes in the buffer are as given by
sourceBuffer , {code offset}, and length . |
close, fillBuffer, haveBytes, read, read, read
available, mark, markSupported, reset, skip
public PeekableInputStream(InputStream inputStream, int bufferSize)
inputStream
- The input stream, which is being buffered.bufferSize
- The size of the CircularByteBuffer
, which is
used internally.public PeekableInputStream(InputStream inputStream)
inputStream
- The input stream, which is being buffered.public boolean peek(byte[] sourceBuffer) throws IOException
sourceBuffer
. This is equivalent to peek(byte[], int, int)
with offset
== 0, and length
== sourceBuffer.length
sourceBuffer
- the buffer to compare againstIOException
- Refilling the buffer failed.public boolean peek(byte[] sourceBuffer, int offset, int length) throws IOException
sourceBuffer
, {code offset}, and length
.sourceBuffer
- the buffer to compare againstoffset
- the start offsetlength
- the length to compareIOException
- if there is a problem calling fillBuffer()Copyright © 2002–2020 The Apache Software Foundation. All rights reserved.