com.lowagie.text.pdf
Class PdfWriter.PdfBody

java.lang.Object
  extended bycom.lowagie.text.pdf.PdfWriter.PdfBody
Enclosing class:
PdfWriter

public static class PdfWriter.PdfBody
extends Object

This class generates the structure of a PDF document.

This class covers the third section of Chapter 5 in the 'Portable Document Format Reference Manual version 1.3' (page 55-60). It contains the body of a PDF document (section 5.14) and it can also generate a Cross-reference Table (section 5.15).

See Also:
PdfWriter, PdfObject, PdfIndirectObject

Nested Class Summary
(package private) static class PdfWriter.PdfBody.PdfCrossReference
          PdfCrossReference is an entry in the PDF Cross-Reference table.
 
Field Summary
private  int position
          the current byteposition in the body.
private  PdfWriter writer
           
private  ArrayList xrefs
          array containing the cross-reference table of the normal objects.
 
Constructor Summary
(package private) PdfWriter.PdfBody(PdfWriter writer)
          Constructs a new PdfBody.
 
Method Summary
(package private)  PdfIndirectObject add(PdfObject object)
          Adds a PdfObject to the body.
(package private)  PdfIndirectObject add(PdfObject object, int refNumber)
           
(package private)  PdfIndirectObject add(PdfObject object, PdfIndirectReference ref)
          Adds a PdfObject to the body given an already existing PdfIndirectReference.
(package private)  int getIndirectReferenceNumber()
           
(package private)  PdfIndirectReference getPdfIndirectReference()
          Gets a PdfIndirectReference for an object that will be created in the future.
(package private)  int offset()
          Returns the offset of the Cross-Reference table.
(package private)  int size()
          Returns the total number of objects contained in the CrossReferenceTable of this Body.
(package private)  void writeCrossReferenceTable(OutputStream os)
          Returns the CrossReferenceTable of the Body.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

xrefs

private ArrayList xrefs
array containing the cross-reference table of the normal objects.


position

private int position
the current byteposition in the body.


writer

private PdfWriter writer
Constructor Detail

PdfWriter.PdfBody

PdfWriter.PdfBody(PdfWriter writer)
Constructs a new PdfBody.

Method Detail

add

PdfIndirectObject add(PdfObject object)
                throws IOException
Adds a PdfObject to the body.

This methods creates a PdfIndirectObject with a certain number, containing the given PdfObject. It also adds a PdfCrossReference for this object to an ArrayList that will be used to build the Cross-reference Table.

Parameters:
object - a PdfObject
Returns:
a PdfIndirectObject
Throws:
IOException

getPdfIndirectReference

PdfIndirectReference getPdfIndirectReference()
Gets a PdfIndirectReference for an object that will be created in the future.

Returns:
a PdfIndirectReference

getIndirectReferenceNumber

int getIndirectReferenceNumber()

add

PdfIndirectObject add(PdfObject object,
                      PdfIndirectReference ref)
                throws IOException
Adds a PdfObject to the body given an already existing PdfIndirectReference.

This methods creates a PdfIndirectObject with the number given by ref, containing the given PdfObject. It also adds a PdfCrossReference for this object to an ArrayList that will be used to build the Cross-reference Table.

Parameters:
object - a PdfObject
ref - a PdfIndirectReference
Returns:
a PdfIndirectObject
Throws:
IOException

add

PdfIndirectObject add(PdfObject object,
                      int refNumber)
                throws IOException
Throws:
IOException

offset

int offset()
Returns the offset of the Cross-Reference table.

Returns:
an offset

size

int size()
Returns the total number of objects contained in the CrossReferenceTable of this Body.

Returns:
a number of objects

writeCrossReferenceTable

void writeCrossReferenceTable(OutputStream os)
                        throws IOException
Returns the CrossReferenceTable of the Body.

Returns:
an array of bytes
Throws:
IOException