com.etymon.pjx
Class PdfObject

java.lang.Object
  extended by com.etymon.pjx.PdfObject
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
PdfArray, PdfBoolean, PdfDictionary, PdfName, PdfNull, PdfNumber, PdfReader.ParserObject, PdfReference, PdfStream, PdfString

public abstract class PdfObject
extends java.lang.Object
implements java.lang.Cloneable

The abstract superclass of all basic PDF object types. It is a requirement that any classes that extend this class be immutable.


Constructor Summary
PdfObject()
           
 
Method Summary
 java.lang.Object clone()
          Returns a shallow copy of this instance.
 boolean equals(java.lang.Object obj)
          Compares this instance with another PDF object for equality.
 PdfObject filter(PdfObjectFilter f)
          Filter this object recursively through PdfObjectFilter.
protected  PdfObject filterContents(PdfObjectFilter f)
          Second stage filtering, called by filter(PdfObjectFilter).
 int hashCode()
          Returns a hash code for this object.
 java.lang.String toString()
          Returns a string representation of this instance in PDF format.
protected abstract  int writePdf(PdfWriter w, boolean spacing)
          Writes this object in PDF format.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PdfObject

public PdfObject()
Method Detail

filter

public PdfObject filter(PdfObjectFilter f)
                 throws PdfFormatException
Filter this object recursively through PdfObjectFilter. The filtered object is returned.

Parameters:
filter - the PdfObjectFilter instance.
Returns:
the new filtered object.
Throws:
PdfFormatException

filterContents

protected PdfObject filterContents(PdfObjectFilter f)
                            throws PdfFormatException
Second stage filtering, called by filter(PdfObjectFilter). This is only called if PdfObjectFilter.preFilter(PdfObject) did not return null.

Parameters:
filter - the PdfObjectFilter instance.
Returns:
the new filtered object.
Throws:
PdfFormatException

clone

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

Overrides:
clone in class java.lang.Object
Returns:
a clone of this instance.

equals

public boolean equals(java.lang.Object obj)
Compares this instance with another PDF object for equality.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to compare this instance with.
Returns:
true if the PDF objects are equal.

hashCode

public int hashCode()
Returns a hash code for this object.

Overrides:
hashCode in class java.lang.Object
Returns:
the hash code.

toString

public java.lang.String toString()
Returns a string representation of this instance in PDF format.

Overrides:
toString in class java.lang.Object
Returns:
the string representation.

writePdf

protected abstract int writePdf(PdfWriter w,
                                boolean spacing)
                         throws java.io.IOException
Writes this object in PDF format.

Parameters:
w - the PdfWriter to write to.
spacing - specifies whether to add white-space before the object. A value of true enables the addition of white-space. If the object begins with a PDF delimiter, then this option is ignored and no white-space is written.
Returns:
the number of bytes written by this method.
Throws:
java.io.IOException