PJX

com.etymon.pjx
Class XrefTable

java.lang.Object
  extended bycom.etymon.pjx.XrefTable

public class XrefTable
extends java.lang.Object

Represents the PDF cross-reference table and associated trailer dictionary. This class is immutable.


Field Summary
static byte ENTRY_FREE
          This indicates that an entry is free.
static byte ENTRY_IN_USE
          This indicates that an entry is in-use.
static byte ENTRY_UNDEFINED
          This indicates that an entry is undefined.
 
Constructor Summary
XrefTable(long[] index, int[] generation, byte[] usage, PdfDictionary trailerDictionary)
          Constructs a cross-reference table from a set of arrays and a trailer dictionary.
 
Method Summary
 java.lang.Object clone()
          Returns a shallow copy of this instance.
 long estimateObjectEnd(int n)
          Returns an offset estimated to be relatively close to the end of the object (specified by object number).
 int getGeneration(int n)
          Returns the generation value for a specified object.
 int[] getGenerationArray()
          Returns the array of generation values.
 long getIndex(int n)
          Returns the index value for a specified object.
 long[] getIndexArray()
          Returns the array of index values.
 PdfDictionary getTrailerDictionary()
          Returns the trailer dictionary associated with this cross-reference table.
 byte getUsage(int n)
          Returns the usage value for a specified object.
 byte[] getUsageArray()
          Returns the array of usage values.
 int size()
          Returns the number of entries in this cross-reference table.
 java.lang.String toString()
          Returns the cross-reference table, associated trailer dictionary, and a complete PDF trailer as a string in PDF format.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ENTRY_FREE

public static final byte ENTRY_FREE
This indicates that an entry is free.

See Also:
Constant Field Values

ENTRY_IN_USE

public static final byte ENTRY_IN_USE
This indicates that an entry is in-use.

See Also:
Constant Field Values

ENTRY_UNDEFINED

public static final byte ENTRY_UNDEFINED
This indicates that an entry is undefined.

See Also:
Constant Field Values
Constructor Detail

XrefTable

public XrefTable(long[] index,
                 int[] generation,
                 byte[] usage,
                 PdfDictionary trailerDictionary)
          throws PdfFormatException
Constructs a cross-reference table from a set of arrays and a trailer dictionary.

Parameters:
index - the array of index values. Each value represents either a byte offset (if in-use) or the next free object number (if free).
generation - the array of generation values.
usage - the array of usage values. Each value is ENTRY_FREE, ENTRY_IN_USE, or ENTRY_UNDEFINED.
trailerDictionary - the trailer dictionary.
Throws:
PdfFormatException
Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Returns a shallow copy of this instance.

Returns:
a clone of this instance.
Throws:
java.lang.CloneNotSupportedException

estimateObjectEnd

public long estimateObjectEnd(int n)
Returns an offset estimated to be relatively close to the end of the object (specified by object number). The offset will be no earlier than the end of the object.

Parameters:
n - the specified object number.
Returns:
the index value, or -1 if the specified object number corresponds to the last object in the document. If the object number does not correspond to an in-use entry, then -1 is returned.

getGeneration

public int getGeneration(int n)
Returns the generation value for a specified object.

Parameters:
n - the object number.
Returns:
the generation value.

getGenerationArray

public int[] getGenerationArray()
Returns the array of generation values. The calling method must not modify this array unless it guarantees that this object exists in no other thread, in order to comply with the immutability requirement of this class.

Returns:
the array of generation values.

getIndex

public long getIndex(int n)
Returns the index value for a specified object.

Parameters:
n - the object number.
Returns:
the index value.

getIndexArray

public long[] getIndexArray()
Returns the array of index values. The calling method must not modify this array unless it guarantees that this object exists in no other thread, in order to comply with the immutability requirement of this class.

Returns:
the array of index values.

getTrailerDictionary

public PdfDictionary getTrailerDictionary()
Returns the trailer dictionary associated with this cross-reference table.

Returns:
the trailer dictionary.

getUsage

public byte getUsage(int n)
Returns the usage value for a specified object.

Parameters:
n - the object number.
Returns:
the usage value.

getUsageArray

public byte[] getUsageArray()
Returns the array of usage values. The calling method must not modify this array unless it guarantees that this object exists in no other thread, in order to comply with the immutability requirement of this class.

Returns:
the array of usage values.

size

public int size()
Returns the number of entries in this cross-reference table.

Returns:
the number of entries.

toString

public java.lang.String toString()
Returns the cross-reference table, associated trailer dictionary, and a complete PDF trailer as a string in PDF format.

Returns:
the PDF string.

Copyright © 1998-2004 Etymon Systems, Inc.

The PDF data structures, operators, and specification are
Copyright © 1985-2004 Adobe Systems Incorporated.