|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.lowagie.text.pdf.PdfObject
com.lowagie.text.pdf.PdfDictionary
com.lowagie.text.pdf.PdfStream
PdfStream is the Pdf stream object.
A stream, like a string, is a sequence of characters. However, an application can
read a small portion of a stream at a time, while a string must be read in its entirety.
For this reason, objects with potentially large amounts of data, such as images and
page descriptions, are represented as streams.
A stream consists of a dictionary that describes a sequence of characters, followed by
the keyword stream, followed by zero or more lines of characters, followed by
the keyword endstream.
All streams must be PdfIndirectObjects. The stream dictionary must be a direct
object. The keyword stream that follows the stream dictionary should be followed by
a carriage return and linefeed or just a linefeed.
Remark: In this version only the FLATEDECODE-filter is supported.
This object is described in the 'Portable Document Format Reference Manual version 1.7'
section 3.2.7 (page 60-63).
PdfObject,
PdfDictionary| Field Summary | |
static int |
BEST_COMPRESSION
A possible compression level. |
static int |
BEST_SPEED
A possible compression level. |
static int |
DEFAULT_COMPRESSION
A possible compression level. |
static int |
NO_COMPRESSION
A possible compression level. |
| Fields inherited from class com.lowagie.text.pdf.PdfDictionary |
CATALOG, FONT, OUTLINES, PAGE, PAGES |
| Fields inherited from class com.lowagie.text.pdf.PdfObject |
ARRAY, BOOLEAN, DICTIONARY, INDIRECT, NAME, NOTHING, NULL, NUMBER, STREAM, STRING, TEXT_PDFDOCENCODING, TEXT_UNICODE |
| Constructor Summary | |
PdfStream(byte[] bytes)
Constructs a PdfStream-object. |
|
PdfStream(InputStream inputStream,
PdfWriter writer)
Creates an efficient stream. |
|
| Method Summary | |
void |
flateCompress()
Compresses the stream. |
void |
flateCompress(int compressionLevel)
|
void |
flateCompress(int compressionLevel,
Boolean compress)
Compresses the stream. |
int |
getRawLength()
Gets the raw length of the stream. |
void |
toPdf(PdfWriter writer,
OutputStream os)
Returns the PDF representation of this PdfDictionary. |
String |
toString()
Returns the String-representation of this PdfObject. |
void |
writeContent(OutputStream os)
Writes the data content to an OutputStream. |
void |
writeLength()
Writes the stream length to the PdfWriter.
|
| Methods inherited from class com.lowagie.text.pdf.PdfDictionary |
contains, get, getAsArray, getAsBoolean, getAsDict, getAsIndirectObject, getAsName, getAsNumber, getAsStream, getAsString, getDirectObject, getKeys, isCatalog, isFont, isOutlineTree, isPage, isPages, merge, mergeDifferent, put, putAll, putEx, remove, size |
| Methods inherited from class com.lowagie.text.pdf.PdfObject |
canBeInObjStm, getBytes, getIndRef, isArray, isBoolean, isDictionary, isIndirect, isName, isNull, isNumber, isStream, isString, length, setIndRef, type |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int DEFAULT_COMPRESSION
public static final int NO_COMPRESSION
public static final int BEST_SPEED
public static final int BEST_COMPRESSION
| Constructor Detail |
public PdfStream(byte[] bytes)
PdfStream-object.
bytes - content of the new PdfObject as an array of byte.
public PdfStream(InputStream inputStream,
PdfWriter writer)
InputStream
is totally consumed but is not closed. The general usage is:
InputStream in = ...; PdfStream stream = new PdfStream(in, writer); stream.flateCompress(); writer.addToBody(stream); stream.writeLength(); in.close();
inputStream - the data to write to this streamwriter - the PdfWriter for this stream| Method Detail |
public void writeLength()
throws IOException
PdfWriter.
This method must be called and can only be called if the constructor PdfStream(InputStream,PdfWriter)
is used to create the stream.
IOException - on errorPdfStream(InputStream,PdfWriter)public int getRawLength()
public void flateCompress()
public void flateCompress(int compressionLevel)
public void flateCompress(int compressionLevel,
Boolean compress)
compressionLevel - the compression level (0 = best speed, 9 = best compression, -1 is default)
public void toPdf(PdfWriter writer,
OutputStream os)
throws IOException
PdfDictionaryPdfDictionary.
toPdf in class PdfDictionaryIOExceptionPdfDictionary.toPdf(com.lowagie.text.pdf.PdfWriter, java.io.OutputStream)
public void writeContent(OutputStream os)
throws IOException
OutputStream.
os - the destination to write to
IOException - on errorpublic String toString()
PdfObjectString-representation of this PdfObject.
toString in class PdfDictionaryPdfObject.toString()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||