Package org.apache.pdfbox.filter
Class FlateFilterDecoderStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- org.apache.pdfbox.filter.FlateFilterDecoderStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public final class FlateFilterDecoderStream extends java.io.FilterInputStreamStream based decoder for the flate filter which uses zlib/deflate compression. Use Inflater instead of InflateInputStream to avoid an EOFException due to a probably missing Z_STREAM_END, see PDFBOX-1232 for details.
-
-
Field Summary
Fields Modifier and Type Field Description private byte[]bufferprivate intbytesDecodedprivate intcurrentDataIndexprivate byte[]decodedDataprivate java.util.zip.Inflaterinflaterprivate booleanisEOFprivate static org.apache.commons.logging.LogLOG
-
Constructor Summary
Constructors Constructor Description FlateFilterDecoderStream(java.io.InputStream inputStream)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()Unsupported.voidclose()This will close the underlying stream and release any resources.private booleanfetch()voidmark(int readlimit)Unsupported.booleanmarkSupported()mark/reset isn't supported.intread()This will read the next byte from the stream.intread(byte[] data, int offset, int length)This will read a chunk of data.voidreset()Unsupported.longskip(long n)Unsupported.
-
-
-
Field Detail
-
LOG
private static final org.apache.commons.logging.Log LOG
-
isEOF
private boolean isEOF
-
currentDataIndex
private int currentDataIndex
-
bytesDecoded
private int bytesDecoded
-
buffer
private byte[] buffer
-
decodedData
private byte[] decodedData
-
inflater
private final java.util.zip.Inflater inflater
-
-
Method Detail
-
fetch
private boolean fetch() throws java.io.IOException- Throws:
java.io.IOException
-
read
public int read() throws java.io.IOExceptionThis will read the next byte from the stream.- Overrides:
readin classjava.io.FilterInputStream- Returns:
- The next byte read from the stream.
- Throws:
java.io.IOException- If there is an error reading from the wrapped stream.
-
read
public int read(byte[] data, int offset, int length) throws java.io.IOExceptionThis will read a chunk of data.- Overrides:
readin classjava.io.FilterInputStream- Parameters:
data- The buffer to write data to.offset- The offset into the data stream.length- The number of byte to attempt to read.- Returns:
- The number of bytes actually read.
- Throws:
java.io.IOException- If there is an error reading data from the underlying stream.
-
close
public void close() throws java.io.IOExceptionThis will close the underlying stream and release any resources.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.FilterInputStream- Throws:
java.io.IOException- If there is an error closing the underlying stream.
-
markSupported
public boolean markSupported()
mark/reset isn't supported.- Overrides:
markSupportedin classjava.io.FilterInputStream- Returns:
- always false.
-
skip
public long skip(long n)
Unsupported.- Overrides:
skipin classjava.io.FilterInputStream- Parameters:
n- ignored.- Returns:
- always zero.
-
available
public int available()
Unsupported.- Overrides:
availablein classjava.io.FilterInputStream- Returns:
- always zero.
-
mark
public void mark(int readlimit)
Unsupported.- Overrides:
markin classjava.io.FilterInputStream- Parameters:
readlimit- ignored.
-
reset
public void reset() throws java.io.IOExceptionUnsupported.- Overrides:
resetin classjava.io.FilterInputStream- Throws:
java.io.IOException- always throw as reset is an unsupported feature.
-
-