org.hccp.pdf
Class CrossReferenceTable

java.lang.Object
  |
  +--org.hccp.pdf.CrossReferenceTable
All Implemented Interfaces:
DocumentObject

public class CrossReferenceTable
extends java.lang.Object
implements DocumentObject

The cross-reference table contains information that permits random access to indirect objects within the file, so that the entire file need not be read to locate any particular object. The table contains a one-line entry for each indirect object, specifying the location of that object within the body of the file.

The cross-reference table is the only part of a PDF file with a fixed format; this permits entries in the table to be accessed randomly. The table comprises one or more cross-reference sections. Initially, the entire table consists of a single section; one additional section is added each time the file is updated.

Each cross-reference section begins with a line containing the keyword xref. Following this line are one or more cross-reference subsections, which may appear in any order. The subsection structure is useful for incremental updates, since it allows a new cross-reference section to be added to the PDF file, containing entries only for objects that have been added or deleted. For a file that has never been updated, the cross-reference section contains only one subsection, whose object numbering begins at 0.

See Also:
CrossReferenceTableEntryException, SubSection

Constructor Summary
CrossReferenceTable()
           
CrossReferenceTable(org.hccp.pdf.Header header, org.hccp.pdf.Body body)
           
 
Method Summary
 org.hccp.pdf.SubSection getSubSection(int firstObject, int objectCount)
          returns the specified subsection from this cross-reference table
 java.lang.String getValue()
           
 void refresh()
          Updates the cross-reference table in regards to document objects added to the PDF document.
 void update(org.hccp.pdf.Header header, org.hccp.pdf.Body body)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CrossReferenceTable

public CrossReferenceTable()

CrossReferenceTable

public CrossReferenceTable(org.hccp.pdf.Header header,
                           org.hccp.pdf.Body body)
Method Detail

refresh

public void refresh()
Updates the cross-reference table in regards to document objects added to the PDF document. Should be called prior to serialization, generation, or output of file.


update

public void update(org.hccp.pdf.Header header,
                   org.hccp.pdf.Body body)

getSubSection

public org.hccp.pdf.SubSection getSubSection(int firstObject,
                                             int objectCount)
returns the specified subsection from this cross-reference table

Parameters:
firstObject - the object number of the start of the subsection to be returned.
objectCount - the number of objects in the subsection to be returned.
Returns:
a SubSection object defined by the starting object number and number of objects in the subsection
See Also:
SubSection

getValue

public java.lang.String getValue()
Specified by:
getValue in interface DocumentObject