Package org.apache.pdfbox.filter
Class Predictor.PredictorOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.FilterOutputStream
-
- org.apache.pdfbox.filter.Predictor.PredictorOutputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.Flushable
,java.lang.AutoCloseable
- Enclosing class:
- Predictor
private static final class Predictor.PredictorOutputStream extends java.io.FilterOutputStream
Output stream that implements predictor decoding. Data is buffered until a complete row is available, which is then decoded and written to the underlying stream. The previous row is retained for decoding the next row.
-
-
Field Summary
Fields Modifier and Type Field Description private int
bitsPerComponent
private int
colors
private int
columns
private byte[]
currentRow
private int
currentRowData
private byte[]
lastRow
private int
predictor
private boolean
predictorPerRow
private boolean
predictorRead
private int
rowLength
-
Constructor Summary
Constructors Constructor Description PredictorOutputStream(java.io.OutputStream out, int predictor, int colors, int bitsPerComponent, int columns)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
decodeAndWriteRow()
private void
flipRows()
Flips the row buffers (to avoid copying), and resets the current-row index and predictorRead flagvoid
flush()
void
write(byte[] bytes)
void
write(byte[] bytes, int off, int len)
void
write(int i)
-
-
-
Field Detail
-
predictor
private int predictor
-
colors
private final int colors
-
bitsPerComponent
private final int bitsPerComponent
-
columns
private final int columns
-
rowLength
private final int rowLength
-
predictorPerRow
private final boolean predictorPerRow
-
currentRow
private byte[] currentRow
-
lastRow
private byte[] lastRow
-
currentRowData
private int currentRowData
-
predictorRead
private boolean predictorRead
-
-
Method Detail
-
write
public void write(byte[] bytes) throws java.io.IOException
- Overrides:
write
in classjava.io.FilterOutputStream
- Throws:
java.io.IOException
-
write
public void write(byte[] bytes, int off, int len) throws java.io.IOException
- Overrides:
write
in classjava.io.FilterOutputStream
- Throws:
java.io.IOException
-
decodeAndWriteRow
private void decodeAndWriteRow() throws java.io.IOException
- Throws:
java.io.IOException
-
flipRows
private void flipRows()
Flips the row buffers (to avoid copying), and resets the current-row index and predictorRead flag
-
flush
public void flush() throws java.io.IOException
- Specified by:
flush
in interfacejava.io.Flushable
- Overrides:
flush
in classjava.io.FilterOutputStream
- Throws:
java.io.IOException
-
write
public void write(int i) throws java.io.IOException
- Overrides:
write
in classjava.io.FilterOutputStream
- Throws:
java.io.IOException
-
-