public class PDFStream extends PDFObject implements Serializable
In PDF, a stream can be compressed using several different methods, or left uncompressed. Here we support both uncompressed and FlateDecode.
Constructor and Description |
---|
PDFStream()
Constructs a plain stream.
|
PDFStream(String type)
Constructs a stream.
|
Modifier and Type | Method and Description |
---|---|
boolean |
getDeflate()
Returs true if the stream will be compressed.
|
OutputStream |
getOutputStream()
Returns the OutputStream that will append to this stream.
|
ByteArrayOutputStream |
getStream()
This is for extenders, and provides access to the stream.
|
String |
getStreamDataString()
Used for printing stream contents in human-readable form, for debugging.
|
PrintWriter |
getWriter()
Creates a PrintWriter that will append to this stream.
|
void |
setDeflate(boolean mode) |
void |
write(OutputStream os)
Writes the object to the output stream.
|
void |
writeStream(OutputStream os)
This inserts the Streams length, then the actual stream, finally the end of stream/object markers.
|
getGeneration, getName, getPDFDocument, getSerialID, getType, setName, toArray, toString, writeEnd, writeStart
public PDFStream()
By default, the stream will be compressed.
public void setDeflate(boolean mode)
mode
- true will FlatDecode the streampublic boolean getDeflate()
public OutputStream getOutputStream()
public PrintWriter getWriter()
public ByteArrayOutputStream getStream()
public void write(OutputStream os) throws IOException
PDFObject
Writes the object to the output stream. This method must be overidden.
Note: It should not write any other objects, even if they are it's Kids, as they will be written by the calling routine.
write
in class PDFObject
os
- OutputStream to send the object toIOException
- on errorpublic void writeStream(OutputStream os) throws IOException
This is intended for anyone extending PDFStream, as objects containing streams do no use writeEnd(), and they must be able to write the actual stream.
os
- OutputStream to send the object toIOException
- on errorpublic String getStreamDataString()