Package org.apache.fop.pdf
Class PDFNumsArray
- java.lang.Object
-
- org.apache.fop.pdf.PDFObject
-
- org.apache.fop.pdf.PDFNumsArray
-
- All Implemented Interfaces:
CompressedObject,PDFWritable
public class PDFNumsArray extends PDFObject
Class representing an "Nums" array object (for Number Trees).
-
-
Constructor Summary
Constructors Constructor Description PDFNumsArray(PDFObject parent)Create a new, empty array object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectget(int key)Gets an entry.java.lang.Objectget(java.lang.Integer key)Gets an entry.private java.lang.ObjectindirectIfReq(java.lang.Object obj)This method provides conformance with the different PDF specs which require or recommend different types be used for Number Tree array values.intlength()Returns the length of the arrayintoutput(java.io.OutputStream stream)Write the PDF represention of this objectvoidput(int key, java.lang.Object obj)Sets an entry.voidput(java.lang.Integer key, java.lang.Object obj)Sets an entry.private booleanshouldConvertToRef(PDFObject obj)Determines whether a value object should be converted to an indirect reference for inclusion in a Number Tree array according to the PDF spec.-
Methods inherited from class org.apache.fop.pdf.PDFObject
contentEquals, encode, encodeBinaryToHexString, encodeString, encodeText, formatObject, getChildren, getDocument, getDocumentSafely, getGeneration, getObjectID, getObjectNumber, getParent, hasObjectNumber, makeReference, outputInline, referencePDF, setDocument, setObjectNumber, setObjectNumber, setObjectNumber, setParent, supportsObjectStream, toPDF, toPDFString
-
-
-
-
Constructor Detail
-
PDFNumsArray
public PDFNumsArray(PDFObject parent)
Create a new, empty array object.- Parameters:
parent- the object's parent if any
-
-
Method Detail
-
length
public int length()
Returns the length of the array- Returns:
- the length of the array
-
shouldConvertToRef
private boolean shouldConvertToRef(PDFObject obj)
Determines whether a value object should be converted to an indirect reference for inclusion in a Number Tree array according to the PDF spec. PDF1.0 - 1.2 - Spec is silent on this subject (as Number Trees don't exist). PDF1.3 & 1.4 - Values must be indirect object refs. PDF1.5 - Recommended: stream, dictionary, array, and string values be indirect object refs. PDF1.6 - 2.0 - Stream values must be indirect object refs. Recommended: dictionary, array, and string values be indirect object refs. Method signals for values that must be, and those recommended to be indirect object refs.- Parameters:
obj- The object to be considered.- Returns:
- True iff the object should be converted.
-
indirectIfReq
private java.lang.Object indirectIfReq(java.lang.Object obj)
This method provides conformance with the different PDF specs which require or recommend different types be used for Number Tree array values. Method indirects objects where indicated.- Parameters:
obj- The object to be considered for indirection.- Returns:
- Either the object or a reference to the object.
-
put
public void put(java.lang.Integer key, java.lang.Object obj)Sets an entry.- Parameters:
key- the key of the value to setobj- the new value
-
put
public void put(int key, java.lang.Object obj)Sets an entry.- Parameters:
key- the key of the value to setobj- the new value
-
get
public java.lang.Object get(java.lang.Integer key)
Gets an entry.- Parameters:
key- the key of requested value- Returns:
- the requested value
-
get
public java.lang.Object get(int key)
Gets an entry.- Parameters:
key- the key of requested value- Returns:
- the requested value
-
output
public int output(java.io.OutputStream stream) throws java.io.IOExceptionWrite the PDF represention of this object- Specified by:
outputin interfaceCompressedObject- Overrides:
outputin classPDFObject- Parameters:
stream- the stream to write the PDF to- Returns:
- the number of bytes written
- Throws:
java.io.IOException- if there is an error writing to the stream
-
-