Package org.apache.pdfbox.filter
Class FlateFilterDecoderStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
org.apache.pdfbox.filter.FlateFilterDecoderStream
- All Implemented Interfaces:
Closeable,AutoCloseable
Stream 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
FieldsModifier and TypeFieldDescriptionprivate byte[]private intprivate intprivate byte[]private final Inflaterprivate booleanprivate static final org.apache.commons.logging.LogFields inherited from class java.io.FilterInputStream
in -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintUnsupported.voidclose()This will close the underlying stream and release any resources.private booleanfetch()voidmark(int readlimit) Unsupported.booleanmark/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.Methods inherited from class java.io.FilterInputStream
readMethods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Field Details
-
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
-
-
Constructor Details
-
FlateFilterDecoderStream
Constructor.- Parameters:
inputStream- The input stream to actually read from.- Throws:
IOException
-
-
Method Details
-
fetch
- Throws:
IOException
-
read
This will read the next byte from the stream.- Overrides:
readin classFilterInputStream- Returns:
- The next byte read from the stream.
- Throws:
IOException- If there is an error reading from the wrapped stream.
-
read
This will read a chunk of data.- Overrides:
readin classFilterInputStream- 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:
IOException- If there is an error reading data from the underlying stream.
-
close
This will close the underlying stream and release any resources.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classFilterInputStream- Throws:
IOException- If there is an error closing the underlying stream.
-
markSupported
public boolean markSupported()mark/reset isn't supported.- Overrides:
markSupportedin classFilterInputStream- Returns:
- always false.
-
skip
public long skip(long n) Unsupported.- Overrides:
skipin classFilterInputStream- Parameters:
n- ignored.- Returns:
- always zero.
-
available
public int available()Unsupported.- Overrides:
availablein classFilterInputStream- Returns:
- always zero.
-
mark
public void mark(int readlimit) Unsupported.- Overrides:
markin classFilterInputStream- Parameters:
readlimit- ignored.
-
reset
Unsupported.- Overrides:
resetin classFilterInputStream- Throws:
IOException- always throw as reset is an unsupported feature.
-