|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.foray.pdf.object.PDFObject
org.foray.pdf.object.PDFStream
public abstract class PDFStream
Superclass for all PDF stream objects. A PDF Stream has two parts: a dictionary, and the stream itself. The stream of commands is where the real work is done, the dictionary just provides information like the stream length.
Field Summary |
---|
Fields inherited from class org.foray.pdf.object.PDFObject |
---|
EOL, MSG_EOL, XREF_EOL |
Constructor Summary | |
---|---|
PDFStream(PDFDocument doc)
Constructor. |
Method Summary | |
---|---|
void |
add(String s)
Append data to the stream. |
void |
addDefaultFilters()
Adds the default filter to this stream. |
void |
addEncryption(PDFEncryption encryption)
Add the encryption filter. |
void |
addFilter(org.axsl.ps.PsEncodeFilter filter)
Add a filter for compression of the stream. |
org.axsl.ps.PsEncodeFilter |
addFilter(String filterType)
Adds a filter of the specified type to this stream. |
protected String |
applyFilters()
Apply the filters to the data in the order given. |
protected abstract void |
finalizeStreamContent()
This method is an explicit opportunity for subclasses to finish writing whatever content may still need to be written to the stream before the dictionary and stream contents are written. |
int |
getDataLength()
Returns the number of bytes written to this stream. |
protected OutputStream |
getOutputStream()
Returns the output stream. |
protected int |
output(OutputStream stream)
Write the PDF represention of this object to a given output stream. |
protected int |
outputStreamData(OutputStream stream)
Output just the stream data enclosed by stream/endstream markers. |
void |
setData(byte[] data)
Writes some data to this stream. |
protected void |
setOutputStream(OutputStream outputStream)
Sets the output stream. |
protected abstract String |
specialStreamDictEntries()
Subclasses return any specialized dictionary entries here, so that they are included when writing the stream dictionary. |
String |
toPDF()
Generates the PDF text necessary to represent the object, returning it as a String. |
Methods inherited from class org.foray.pdf.object.PDFObject |
---|
bufferToByteArray, byteArrayToStream, getCharsPerLine, getGeneration, getLogger, getNumber, getPDFDocument, pdfID, pdfReference, setNumber, stringToByteArray |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PDFStream(PDFDocument doc)
doc
- The PDFDocument to which this stream is attached.Method Detail |
---|
public void add(String s) throws org.axsl.pdf.PdfException
s
- The string of PDF to add.
org.axsl.pdf.PdfException
- For errors writing to output.public void addFilter(org.axsl.ps.PsEncodeFilter filter) throws org.axsl.pdf.PdfException
filter
- The filter to be added.
org.axsl.pdf.PdfException
- For errors adding the filter.public void addEncryption(PDFEncryption encryption)
encryption
- The encryption filter to add.public org.axsl.ps.PsEncodeFilter addFilter(String filterType) throws org.axsl.pdf.PdfException
filterType
- The type of filter to add, one of "flate", "ascii-85",
or "ascii-hex".
org.axsl.pdf.PdfException
- For errors while adding the filter.public void addDefaultFilters() throws org.axsl.pdf.PdfException
org.axsl.pdf.PdfException
- For errors while adding the filters.public void setData(byte[] data) throws org.axsl.pdf.PdfException
data
- The data to be written.
org.axsl.pdf.PdfException
- For errors when writing.public int getDataLength()
public String toPDF()
PDFObject
protected int output(OutputStream stream) throws org.axsl.pdf.PdfException
PDFObject
output
in class PDFObject
stream
- The stream to which the PDF content is being written.
org.axsl.pdf.PdfException
- For I/O errors during output.protected abstract void finalizeStreamContent() throws org.axsl.pdf.PdfException
org.axsl.pdf.PdfException
- For errors writing stream content.protected abstract String specialStreamDictEntries() throws org.axsl.pdf.PdfException
org.axsl.pdf.PdfException
- For errors creating the dictionary entries.protected int outputStreamData(OutputStream stream) throws org.axsl.pdf.PdfException
stream
- The stream to which the data should be written.
org.axsl.pdf.PdfException
- For errors during writing.protected String applyFilters()
protected OutputStream getOutputStream()
protected void setOutputStream(OutputStream outputStream)
outputStream
- The new output stream.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |