public class PDFStream extends AbstractPDFStream
A derivative of the PDF Object, a PDF Stream has not only a dictionary but a stream of PDF commands. The stream of commands is where the real work is done, the dictionary just provides information like the stream length.
| Modifier and Type | Field and Description |
|---|---|
protected StreamCache |
data
The stream of PDF commands
|
| Constructor and Description |
|---|
PDFStream()
Create an empty stream object
|
PDFStream(boolean encodeOnTheFly) |
PDFStream(PDFDictionary dictionary) |
PDFStream(PDFDictionary dictionary,
boolean encodeOnTheFly) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(String s)
Append data to the stream
|
void |
add(StringBuffer sb)
Append data to the stream
|
OutputStream |
getBufferOutputStream()
Returns an OutputStream that can be used to write to the buffer which is used
to build up the PDF stream.
|
Writer |
getBufferWriter()
Returns a Writer that writes to the OutputStream of the buffer.
|
int |
getDataLength()
Returns the size of the content.
|
protected int |
getSizeHint()
Returns a value that hints at the size of the encoded stream.
|
int |
output(OutputStream stream)
Overload the base object method so we don't have to copy
byte arrays around so much
Write the PDF represention of this object
|
protected void |
outputRawStreamData(OutputStream out)
Sends the raw stream data to the target OutputStream.
|
void |
setData(byte[] data)
Used to set the contents of the PDF stream.
|
String |
streamHashCode() |
encodeAndWriteStream, encodeStream, get, getChildren, getDefaultFilterName, getDictionary, getFilterList, multipleFiltersAllowed, outputStreamData, populateStreamDict, prepareImplicitFilters, put, registerChildren, setDocument, setupFilterList, supportsObjectStreamcontentEquals, encode, encodeBinaryToHexString, encodeString, encodeText, formatObject, getDocument, getDocumentSafely, getGeneration, getObjectID, getObjectNumber, getParent, hasObjectNumber, makeReference, outputInline, referencePDF, setObjectNumber, setObjectNumber, setObjectNumber, setParent, toPDF, toPDFStringprotected StreamCache data
public PDFStream()
public PDFStream(PDFDictionary dictionary)
public PDFStream(PDFDictionary dictionary, boolean encodeOnTheFly)
public PDFStream(boolean encodeOnTheFly)
public void add(String s)
s - the string of PDF to addpublic void add(StringBuffer sb)
sb - the string buffer of PDF to addpublic Writer getBufferWriter()
public OutputStream getBufferOutputStream() throws IOException
IOException - In case of an I/O problempublic void setData(byte[] data)
throws IOException
data - the contents as a byte arrayIOException - in case of an I/O problempublic int getDataLength()
protected int getSizeHint()
throws IOException
getSizeHint in class AbstractPDFStreamIOException - in case of an I/O problemprotected void outputRawStreamData(OutputStream out) throws IOException
outputRawStreamData in class AbstractPDFStreamout - OutputStream to write toIOException - In case of an I/O problempublic int output(OutputStream stream) throws IOException
output in class AbstractPDFStreamstream - the stream to write the PDF toIOException - if there is an error writing to the streampublic String streamHashCode() throws IOException
IOExceptionCopyright © 2025 Apache Software Foundation. All rights reserved.