public class PeekableInputStream extends CircularBufferInputStream
Constructor and Description |
---|
PeekableInputStream(java.io.InputStream inputStream)
Creates a new instance, which filters the given input stream, and uses a reasonable default buffer size (
IOUtils.DEFAULT_BUFFER_SIZE ). |
PeekableInputStream(java.io.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, read, read
public PeekableInputStream(java.io.InputStream inputStream)
IOUtils.DEFAULT_BUFFER_SIZE
).inputStream
- The input stream, which is being buffered.public PeekableInputStream(java.io.InputStream inputStream, int bufferSize)
inputStream
- The input stream, which is being buffered.bufferSize
- The size of the CircularByteBuffer
, which is used internally.public boolean peek(byte[] sourceBuffer) throws java.io.IOException
sourceBuffer
. This is equivalent to
peek(byte[], int, int)
with offset
== 0, and length
== sourceBuffer.length
sourceBuffer
- the buffer to compare againstjava.io.IOException
- Refilling the buffer failed.public boolean peek(byte[] sourceBuffer, int offset, int length) throws java.io.IOException
sourceBuffer
, {code offset}, and
length
.sourceBuffer
- the buffer to compare againstoffset
- the start offsetlength
- the length to comparejava.io.IOException
- if there is a problem calling fillBuffer()Copyright © 2010 - 2023 Adobe. All Rights Reserved