|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.InputStream
java.io.FilterInputStream
java.io.PushbackInputStream
org.apache.pdfbox.io.PushBackInputStream
public class PushBackInputStream
A simple subclass that adds a few convience methods.
| Field Summary |
|---|
| Fields inherited from class java.io.PushbackInputStream |
|---|
buf, pos |
| Fields inherited from class java.io.FilterInputStream |
|---|
in |
| Constructor Summary | |
|---|---|
PushBackInputStream(InputStream input,
int size)
Constructor. |
|
| Method Summary | |
|---|---|
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)
|
| Methods inherited from class java.io.PushbackInputStream |
|---|
available, close, mark, markSupported, reset, skip |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PushBackInputStream(InputStream input,
int size)
throws IOException
input - The input stream.size - The size of the push back buffer.
IOException - If there is an error with the stream.| Method Detail |
|---|
public int peek()
throws IOException
IOException - If there is an error reading the next byte.public long getOffset()
public int read()
throws IOException
read in class PushbackInputStreamIOException
public int read(byte[] b)
throws IOException
read in class FilterInputStreamIOException
public int read(byte[] b,
int off,
int len)
throws IOException
read in class PushbackInputStreamIOException
public void unread(int b)
throws IOException
unread in class PushbackInputStreamIOException
public void unread(byte[] b)
throws IOException
unread in class PushbackInputStreamIOException
public void unread(byte[] b,
int off,
int len)
throws IOException
unread in class PushbackInputStreamIOException
public boolean isEOF()
throws IOException
IOException - If there is an error reading the next byte.
public void fillBuffer()
throws IOException
IOException - If there is an error filling the buffer.
public byte[] readFully(int length)
throws IOException
length - the number of bytes to be read
IOException - if an I/O error occurs while reading data
public void seek(long newOffset)
throws 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 next
IOException - if underlying stream does not implement RandomAccessRead
or seek operation on underlying stream was not successful
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||