Save This Page
Home » iText-src-2.1.3 » com.lowagie » text » pdf » [javadoc | source]
com.lowagie.text.pdf
public class: PdfStream [javadoc | source]
java.lang.Object
   com.lowagie.text.pdf.PdfObject
      com.lowagie.text.pdf.PdfDictionary
         com.lowagie.text.pdf.PdfStream

Direct Known Subclasses:
    PdfImage, PdfContents, StreamFont, PdfFormXObject, PdfEFStream, PdfPattern, PdfICCBased, PRStream

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).

Field Summary
public static final  int DEFAULT_COMPRESSION    A possible compression level.
    since: 2.1.3 -
 
public static final  int NO_COMPRESSION    A possible compression level.
    since: 2.1.3 -
 
public static final  int BEST_SPEED    A possible compression level.
    since: 2.1.3 -
 
public static final  int BEST_COMPRESSION    A possible compression level.
    since: 2.1.3 -
 
protected  boolean compressed    is the stream compressed? 
protected  int compressionLevel    The level of compression.
    since: 2.1.3 -
 
protected  ByteArrayOutputStream streamBytes     
protected  InputStream inputStream     
protected  PdfIndirectReference ref     
protected  int inputStreamLength     
protected  PdfWriter writer     
protected  int rawLength     
static final  byte[] STARTSTREAM     
static final  byte[] ENDSTREAM     
static final  int SIZESTREAM     
Fields inherited from com.lowagie.text.pdf.PdfDictionary:
FONT,  OUTLINES,  PAGE,  PAGES,  CATALOG,  hashMap
Fields inherited from com.lowagie.text.pdf.PdfObject:
BOOLEAN,  NUMBER,  STRING,  NAME,  ARRAY,  DICTIONARY,  STREAM,  NULL,  INDIRECT,  NOTHING,  TEXT_PDFDOCENCODING,  TEXT_UNICODE,  bytes,  type,  indRef
Constructor:
 protected PdfStream() 
 public PdfStream(byte[] bytes) 
 public PdfStream(InputStream inputStream,
    PdfWriter writer) 
    Creates an efficient stream. No temporary array is ever created. The 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();
    
    Parameters:
    inputStream - the data to write to this stream
    writer - the PdfWriter for this stream
Method from com.lowagie.text.pdf.PdfStream Summary:
flateCompress,   flateCompress,   getRawLength,   superToPdf,   toPdf,   toString,   writeContent,   writeLength
Methods from 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,   toPdf,   toString
Methods from com.lowagie.text.pdf.PdfObject:
canBeInObjStm,   getBytes,   getIndRef,   isArray,   isBoolean,   isDictionary,   isIndirect,   isName,   isNull,   isNumber,   isStream,   isString,   length,   setContent,   setIndRef,   toPdf,   toString,   type
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from com.lowagie.text.pdf.PdfStream Detail:
 public  void flateCompress() 
    Compresses the stream.
 public  void flateCompress(int compressionLevel) 
    Compresses the stream.
 public int getRawLength() 
    Gets the raw length of the stream.
 protected  void superToPdf(PdfWriter writer,
    OutputStream os) throws IOException 
 public  void toPdf(PdfWriter writer,
    OutputStream os) throws IOException 
 public String toString() 
 public  void writeContent(OutputStream os) throws IOException 
    Writes the data content to an OutputStream.
 public  void writeLength() throws IOException 
    Writes the stream length to the PdfWriter.

    This method must be called and can only be called if the constructor #PdfStream(InputStream,PdfWriter) is used to create the stream.