Package org.apache.pdfbox.cos
Class COSOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.FilterOutputStream
-
- org.apache.pdfbox.cos.COSOutputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.Flushable
,java.lang.AutoCloseable
public final class COSOutputStream extends java.io.FilterOutputStream
An OutputStream which writes to an encoded COS stream.
-
-
Field Summary
Fields Modifier and Type Field Description private RandomAccess
buffer
private java.util.List<Filter>
filters
private COSDictionary
parameters
private ScratchFile
scratchFile
-
Constructor Summary
Constructors Constructor Description COSOutputStream(java.util.List<Filter> filters, COSDictionary parameters, java.io.OutputStream output, ScratchFile scratchFile)
Creates a new COSOutputStream writes to an encoded COS stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
flush()
void
write(byte[] b)
void
write(byte[] b, int off, int len)
void
write(int b)
-
-
-
Field Detail
-
filters
private final java.util.List<Filter> filters
-
parameters
private final COSDictionary parameters
-
scratchFile
private final ScratchFile scratchFile
-
buffer
private RandomAccess buffer
-
-
Constructor Detail
-
COSOutputStream
COSOutputStream(java.util.List<Filter> filters, COSDictionary parameters, java.io.OutputStream output, ScratchFile scratchFile) throws java.io.IOException
Creates a new COSOutputStream writes to an encoded COS stream.- Parameters:
filters
- Filters to apply.parameters
- Filter parameters.output
- Encoded stream.scratchFile
- Scratch file to use.- Throws:
java.io.IOException
- If there was an error creating a temporary buffer
-
-
Method Detail
-
write
public void write(byte[] b) throws java.io.IOException
- Overrides:
write
in classjava.io.FilterOutputStream
- Throws:
java.io.IOException
-
write
public void write(byte[] b, int off, int len) throws java.io.IOException
- Overrides:
write
in classjava.io.FilterOutputStream
- Throws:
java.io.IOException
-
write
public void write(int b) throws java.io.IOException
- Overrides:
write
in classjava.io.FilterOutputStream
- Throws:
java.io.IOException
-
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
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.FilterOutputStream
- Throws:
java.io.IOException
-
-