java.io.Closeable, java.lang.AutoCloseableByteArrayPushBackInputStreampublic class PushBackInputStream
extends java.io.PushbackInputStream
| Constructor | Description |
|---|---|
PushBackInputStream(java.io.InputStream input,
int size) |
Constructor.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
fillBuffer() |
This is a method used to fix PDFBox issue 974661, the PDF parsing code needs
to know if there is at least x amount of data left in the stream, but the available()
method returns how much data will be available without blocking.
|
long |
getOffset() |
Returns the current byte offset in the file.
|
boolean |
isEOF() |
A simple test to see if we are at the end of the stream.
|
int |
peek() |
This will peek at the next byte.
|
int |
read() |
|
int |
read(byte[] b) |
|
int |
read(byte[] b,
int off,
int len) |
|
byte[] |
readFully(int length) |
Reads a given number of bytes from the underlying stream.
|
void |
seek(long newOffset) |
Allows to seek to another position within stream in case the underlying
stream implements
RandomAccessRead. |
void |
unread(byte[] b) |
|
void |
unread(byte[] b,
int off,
int len) |
|
void |
unread(int b) |
public PushBackInputStream(java.io.InputStream input,
int size)
throws java.io.IOException
input - The input stream.size - The size of the push back buffer.java.io.IOException - If there is an error with the stream.public int peek()
throws java.io.IOException
java.io.IOException - If there is an error reading the next byte.public long getOffset()
public int read()
throws java.io.IOException
read in class java.io.PushbackInputStreamjava.io.IOExceptionpublic int read(byte[] b)
throws java.io.IOException
read in class java.io.FilterInputStreamjava.io.IOExceptionpublic int read(byte[] b,
int off,
int len)
throws java.io.IOException
read in class java.io.PushbackInputStreamjava.io.IOExceptionpublic void unread(int b)
throws java.io.IOException
unread in class java.io.PushbackInputStreamjava.io.IOExceptionpublic void unread(byte[] b)
throws java.io.IOException
unread in class java.io.PushbackInputStreamjava.io.IOExceptionpublic void unread(byte[] b,
int off,
int len)
throws java.io.IOException
unread in class java.io.PushbackInputStreamjava.io.IOExceptionpublic boolean isEOF()
throws java.io.IOException
java.io.IOException - If there is an error reading the next byte.public void fillBuffer()
throws java.io.IOException
java.io.IOException - If there is an error filling the buffer.public byte[] readFully(int length)
throws java.io.IOException
length - the number of bytes to be readjava.io.IOException - if an I/O error occurs while reading datapublic void seek(long newOffset)
throws java.io.IOException
RandomAccessRead. Otherwise an IOException
is thrown.
Pushback buffer is cleared before seek operation by skipping over all bytes
of buffer.newOffset - new position within stream from which to read nextjava.io.IOException - if underlying stream does not implement RandomAccessRead
or seek operation on underlying stream was not successful