Class CosObject
- java.lang.Object
-
- com.adobe.internal.pdftoolkit.core.cos.CosObject
-
- Direct Known Subclasses:
CosContainer
,CosScalar
public abstract class CosObject extends Object
Base class for all COS objects.
-
-
Field Summary
Fields Modifier and Type Field Description static int
DIRECT
static int
INDIRECT
static int
t_Array
static int
t_Boolean
static int
t_Dictionary
static int
t_KeyAbsent
static int
t_Name
static int
t_Null
static int
t_Numeric
static int
t_ObjectRef
static int
t_Stream
static int
t_String
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
booleanValue()
Returns boolean value if it's type ofCosBoolean
else throws exception.double
doubleValue()
Returns double value if it's type ofCosNumeric
else throws exception.abstract boolean
equals(CosObject value)
This method returns true if either they have same reference or have same data inside.boolean
equals(Object value)
Object.equals(Object) is overridden here.CosDocument
getDocument()
Obtain the COS document that contains this object.long
getObjEOF()
Return EOF of object's update section or zero if cannot be determined.int
getObjGen()
Indirect object generation or -1 if directint
getObjNum()
Indirect object number or zero if directlong
getObjPos()
Return object's position or zero if cannot be determined.int
getObjRevision()
Return index of object's update section or -1 if cannot be determined.StreamManager
getStreamManager()
Obtain the StreamManager for the document containing this object.abstract int
getType()
return which of the concrete subtypes of CosObject we areabstract Object
getValue()
ASHexString
hexStringValue()
Returns hex string value if it's type ofCosString
else throws exception.int
intValue()
Accessor functions for scalar CosObjects.boolean
isCompressed()
Returns true if this INDIRECT object currently resides in an object stream.boolean
isDirty()
Returns if this cosobject is dirty, else false.boolean
isIndirect()
long
longValue()
Returns long value if it's type ofCosNumeric
else throws exception.ASName
nameValue()
Returns name value if it's type ofCosName
else throws exception.Number
numberValue()
Returns number value if it's type ofCosNumeric
else throws exception.ASString
stringValue()
Returns string value if it's type ofCosString
else throws exception.String
textValue()
Returns text value if it's type ofCosString
else throws exception.String
toString()
-
-
-
Field Detail
-
t_Null
public static final int t_Null
- See Also:
- Constant Field Values
-
t_Numeric
public static final int t_Numeric
- See Also:
- Constant Field Values
-
t_Boolean
public static final int t_Boolean
- See Also:
- Constant Field Values
-
t_Name
public static final int t_Name
- See Also:
- Constant Field Values
-
t_String
public static final int t_String
- See Also:
- Constant Field Values
-
t_Array
public static final int t_Array
- See Also:
- Constant Field Values
-
t_Dictionary
public static final int t_Dictionary
- See Also:
- Constant Field Values
-
t_Stream
public static final int t_Stream
- See Also:
- Constant Field Values
-
t_ObjectRef
public static final int t_ObjectRef
- See Also:
- Constant Field Values
-
t_KeyAbsent
public static final int t_KeyAbsent
- See Also:
- Constant Field Values
-
DIRECT
public static final int DIRECT
- See Also:
- Constant Field Values
-
INDIRECT
public static final int INDIRECT
- See Also:
- Constant Field Values
-
-
Method Detail
-
getType
public abstract int getType()
return which of the concrete subtypes of CosObject we are- Returns:
- one of the t_Mumble static final int values defined above
-
getValue
public abstract Object getValue() throws PDFCosParseException, PDFIOException, PDFSecurityException
- Returns:
- Object value of CosObject
- Throws:
PDFCosParseException
PDFIOException
PDFSecurityException
-
isIndirect
public boolean isIndirect()
-
getObjNum
public int getObjNum()
Indirect object number or zero if direct
-
getObjGen
public int getObjGen()
Indirect object generation or -1 if direct
-
getObjEOF
public long getObjEOF()
Return EOF of object's update section or zero if cannot be determined.
-
getObjRevision
public int getObjRevision()
Return index of object's update section or -1 if cannot be determined.
-
getObjPos
public long getObjPos()
Return object's position or zero if cannot be determined.
-
isCompressed
public boolean isCompressed()
Returns true if this INDIRECT object currently resides in an object stream. Returns false always if direct.
-
intValue
public int intValue()
Accessor functions for scalar CosObjects. These are defined in the base class to avoid having to make an explicit cast after determining the subclass by either getType() or instanceof. The ones defined in the base class all throw RuntimeException. For each scalar subclass the appropriate method is overridden, so getting here represents a "can't happen" situation.
-
longValue
public long longValue()
Returns long value if it's type ofCosNumeric
else throws exception.
-
doubleValue
public double doubleValue()
Returns double value if it's type ofCosNumeric
else throws exception.
-
numberValue
public Number numberValue()
Returns number value if it's type ofCosNumeric
else throws exception.
-
booleanValue
public boolean booleanValue()
Returns boolean value if it's type ofCosBoolean
else throws exception.
-
nameValue
public ASName nameValue()
Returns name value if it's type ofCosName
else throws exception.
-
stringValue
public ASString stringValue() throws PDFSecurityException
Returns string value if it's type ofCosString
else throws exception.- Throws:
PDFSecurityException
-
hexStringValue
public ASHexString hexStringValue() throws PDFSecurityException
Returns hex string value if it's type ofCosString
else throws exception.- Throws:
PDFSecurityException
-
textValue
public String textValue() throws PDFSecurityException
Returns text value if it's type ofCosString
else throws exception.- Throws:
PDFSecurityException
-
getDocument
public CosDocument getDocument()
Obtain the COS document that contains this object.- Returns:
- COSDocument containing this object.
-
getStreamManager
public StreamManager getStreamManager()
Obtain the StreamManager for the document containing this object.- Returns:
- StreamManager to use for this COS object.
-
isDirty
public boolean isDirty()
Returns if this cosobject is dirty, else false.
-
equals
public abstract boolean equals(CosObject value)
This method returns true if either they have same reference or have same data inside. Returns false if passed CosObject is not on same document.- Parameters:
value
-- Returns:
- boolean
-
-