com.lowagie.text.pdf
Class PdfStream

java.lang.Object
  |
  +--com.lowagie.text.pdf.PdfObject
        |
        +--com.lowagie.text.pdf.PdfDictionary
              |
              +--com.lowagie.text.pdf.PdfStream
Direct Known Subclasses:
BaseFont.StreamFont, PdfContents, PdfFormXObject, PdfICCBased, PdfImage, PdfPattern, PRStream

public class PdfStream
extends PdfDictionary

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.3' section 4.8 (page 41-53).

See Also:
PdfObject, PdfDictionary

Field Summary
protected  boolean compressed
          is the stream compressed?
(package private) static byte[] ENDSTREAM
           
(package private) static int SIZESTREAM
           
(package private) static byte[] STARTSTREAM
           
protected  ByteArrayOutputStream streamBytes
           
 
Fields inherited from class com.lowagie.text.pdf.PdfDictionary
CATALOG, FONT, hashMap, OUTLINES, PAGE, PAGES
 
Fields inherited from class com.lowagie.text.pdf.PdfObject
ARRAY, BOOLEAN, bytes, DICTIONARY, INDIRECT, NAME, NOTHING, NULL, NUMBER, STREAM, STRING, TEXT_PDFDOCENCODING, TEXT_UNICODE, type
 
Constructor Summary
protected PdfStream()
          Constructs a PdfStream-object.
  PdfStream(byte[] bytes)
          Constructs a PdfStream-object.
 
Method Summary
 void flateCompress()
          Compresses the stream.
protected  void superToPdf(PdfWriter writer, OutputStream os)
           
 void toPdf(PdfWriter writer, OutputStream os)
          Returns the PDF representation of this PdfDictionary.
 
Methods inherited from class com.lowagie.text.pdf.PdfDictionary
contains, get, getKeys, isCatalog, isDictionaryType, isFont, isOutlineTree, isPage, isPages, merge, mergeDifferent, put, putAll, putDel, putEx, remove, size
 
Methods inherited from class com.lowagie.text.pdf.PdfObject
getBytes, isArray, isBoolean, isDictionary, isName, isNull, isNumber, isStream, isString, length, setContent, toString, type
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

compressed

protected boolean compressed
is the stream compressed?


streamBytes

protected ByteArrayOutputStream streamBytes

STARTSTREAM

static final byte[] STARTSTREAM

ENDSTREAM

static final byte[] ENDSTREAM

SIZESTREAM

static final int SIZESTREAM
Constructor Detail

PdfStream

public PdfStream(byte[] bytes)
Constructs a PdfStream-object.

Parameters:
bytes - content of the new PdfObject as an array of byte.

PdfStream

protected PdfStream()
Constructs a PdfStream-object.

Method Detail

flateCompress

public void flateCompress()
                   throws PdfException
Compresses the stream.

Throws:
PdfException - if a filter is already defined

superToPdf

protected void superToPdf(PdfWriter writer,
                          OutputStream os)
                   throws IOException
IOException

toPdf

public void toPdf(PdfWriter writer,
                  OutputStream os)
           throws IOException
Description copied from class: PdfDictionary
Returns the PDF representation of this PdfDictionary.

Overrides:
toPdf in class PdfDictionary
Returns:
an array of byte
IOException