Class CosString
- java.lang.Object
-
- com.adobe.internal.pdftoolkit.core.cos.CosObject
-
- com.adobe.internal.pdftoolkit.core.cos.CosScalar
-
- com.adobe.internal.pdftoolkit.core.cos.CosString
-
public class CosString extends CosScalar
Represents a COS string as defined in section 3.2.3 of the PDF Reference Manual version 1.4.
-
-
Field Summary
-
Fields inherited from class com.adobe.internal.pdftoolkit.core.cos.CosObject
DIRECT, INDIRECT, t_Array, t_Boolean, t_Dictionary, t_KeyAbsent, t_Name, t_Null, t_Numeric, t_ObjectRef, t_Stream, t_String
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ASDateasDate()Returns this string asASDateif it's in proper date format else throws exception.java.lang.StringasString()Returns String value.byte[]byteArrayValue()Obtains the string data.booleanequals(byte[] b)booleanequals(CosObject value)This method returns true if both CosStrings have same byte array inside.booleanequals(CosString string)booleanequals(ASString string)booleangetIsEncrypted()Tells whether this string is already encrypted or not.booleangetToEncrypt()Returns true if string is to be encrypted.intgetType()return the type of this CosObjectjava.lang.ObjectgetValue()booleangetWriteHex()Returns true if this string is written in hex format.ASHexStringhexStringValue()Returns hex string value if it's type ofCosStringelse throws exception.booleanisOddBall()Returns true if this is hex string and ended on odd nibble.voidsetDataInternal(byte[] newData, boolean markDirty)Only for internal engineering use.voidsetIsEncrypted(boolean encrypted)Sets the flag which tells whether this string is already encrypted or not.voidsetToEncrypt(boolean encrypted)Sets true if string is to be encrypted.voidsetWriteHex(boolean b)If true is passed here then this string is written in hex format.ASStringstringValue()Returns string value if it's type ofCosStringelse throws exception.java.lang.StringtextValue()Creates an instance of a String object "wrapping" the specified CosString.java.lang.StringtoString()-
Methods inherited from class com.adobe.internal.pdftoolkit.core.cos.CosObject
booleanValue, doubleValue, equals, getDocument, getObjEOF, getObjGen, getObjNum, getObjPos, getObjRevision, getStreamManager, intValue, isCompressed, isDirty, isIndirect, longValue, nameValue, numberValue
-
-
-
-
Method Detail
-
getType
public int getType()
return the type of this CosObject
-
byteArrayValue
public byte[] byteArrayValue() throws PDFSecurityExceptionObtains the string data. The first time the method is called, the string data is decrypted, if necessary, and the desired portion of the original data buffer is extracted.- Returns:
- Byte array containing the string data.
- Throws:
PDFSecurityException
-
stringValue
public ASString stringValue() throws PDFSecurityException
Description copied from class:CosObjectReturns string value if it's type ofCosStringelse throws exception.- Overrides:
stringValuein classCosObject- Throws:
PDFSecurityException
-
hexStringValue
public ASHexString hexStringValue() throws PDFSecurityException
Description copied from class:CosObjectReturns hex string value if it's type ofCosStringelse throws exception.- Overrides:
hexStringValuein classCosObject- Throws:
PDFSecurityException
-
asString
public java.lang.String asString() throws PDFSecurityExceptionReturns String value.- Throws:
PDFSecurityException
-
getValue
public java.lang.Object getValue() throws PDFSecurityException- Specified by:
getValuein classCosObject- Returns:
- Object value of CosObject
- Throws:
PDFSecurityException
-
textValue
public java.lang.String textValue() throws PDFSecurityExceptionCreates an instance of a String object "wrapping" the specified CosString. This method is called by the Factory class. A Class implementing the Constructible interface must implement this method.- Overrides:
textValuein classCosObject- Returns:
- Newly created String object or null if data is null.
- Throws:
PDFSecurityException
-
setDataInternal
public void setDataInternal(byte[] newData, boolean markDirty) throws PDFCosParseException, PDFIOException, PDFSecurityExceptionOnly for internal engineering use. This api can change without notice. Hack for DigSig. Overwrite string contents with passed byte array.
-
asDate
public ASDate asDate() throws PDFCosParseException, PDFSecurityException
Returns this string asASDateif it's in proper date format else throws exception.
-
setWriteHex
public void setWriteHex(boolean b)
If true is passed here then this string is written in hex format.
-
getWriteHex
public boolean getWriteHex()
Returns true if this string is written in hex format.
-
isOddBall
public boolean isOddBall()
Returns true if this is hex string and ended on odd nibble.
-
setToEncrypt
public void setToEncrypt(boolean encrypted)
Sets true if string is to be encrypted.
-
getToEncrypt
public boolean getToEncrypt()
Returns true if string is to be encrypted.
-
setIsEncrypted
public void setIsEncrypted(boolean encrypted)
Sets the flag which tells whether this string is already encrypted or not.
-
getIsEncrypted
public boolean getIsEncrypted()
Tells whether this string is already encrypted or not.
-
equals
public boolean equals(ASString string)
-
equals
public boolean equals(CosString string)
-
equals
public boolean equals(CosObject value)
This method returns true if both CosStrings have same byte array inside. Returns false if passed CosObject is not an instance of CosString or not on same document.
-
equals
public boolean equals(byte[] b)
-
-