public class HexStringObject extends java.lang.Object implements StringObject
This class represents a PDF Hexadecimal String Object. Hexadecimal String objects are written as a sequence of literal characters enclosed in angled brackets <>.
| Constructor and Description |
|---|
HexStringObject(byte[] bytes)
Creates a new hexadecimal string object so that it represents the same
sequence of bytes as in the bytes argument.
|
HexStringObject(java.lang.String string) |
HexStringObject(java.lang.StringBuilder stringBuffer)
Creates a new hexadecimal string object so that it represents the same
sequence of character data specified by the argument.
|
HexStringObject(java.lang.String string,
Reference reference,
SecurityManager securityManager)
Creates a new literal string object so that it represents the same
sequence of character data specified by the arguments.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
encryption(java.lang.String string,
boolean decrypt,
SecurityManager securityManager)
Decrypts or encrypts a string.
|
java.lang.String |
getDecryptedLiteralString(SecurityManager securityManager)
Gets the decrypted literal string value of the data using the key provided by the
security manager.
|
java.lang.String |
getHexString()
Gets a hexadecimal String representation of this object's data, which
is in fact, the raw data contained in this object
|
java.lang.StringBuilder |
getHexStringBuffer()
Gets a hexadecimal StringBuffer representation of this object's data,
which is in fact the raw data contained in this object.
|
int |
getLength()
The length of the underlying objects data.
|
java.lang.String |
getLiteralString()
Gets a literal String representation of this object's data.
|
java.lang.StringBuilder |
getLiteralStringBuffer()
Gets a literal StringBuffer representation of this object's data.
|
java.lang.StringBuilder |
getLiteralStringBuffer(int fontFormat,
FontFile font)
Gets a literal String representation of this object's data using the
specifed font and format.
|
Reference |
getReference()
Sets the parent PDF object's reference.
|
int |
getUnsignedInt(int start,
int offset)
Gets the integer value of the hexidecimal data specified by the start and
offset parameters.
|
int |
getUnsignedInt(java.lang.String data) |
void |
setReference(Reference reference)
Sets the parent PDF object's reference.
|
java.lang.String |
toString()
Returns a string representation of the object.
|
public HexStringObject(byte[] bytes)
Creates a new hexadecimal string object so that it represents the same sequence of bytes as in the bytes argument. In other words, the initial content of the hexadecimal string is the characters represented by the byte data.
bytes - array of bytes which will be interpreted as hexadecimal
data.public HexStringObject(java.lang.StringBuilder stringBuffer)
Creates a new hexadecimal string object so that it represents the same sequence of character data specified by the argument. This constructor should only be used in the context of the parser which has leading and ending angled brackets which are removed by this method.
stringBuffer - the initial contents of the hexadecimal string objectpublic HexStringObject(java.lang.String string)
public HexStringObject(java.lang.String string,
Reference reference,
SecurityManager securityManager)
Creates a new literal string object so that it represents the same sequence of character data specified by the arguments. The string value is assumed to be unencrypted and will be encrypted. The method #LiteralStringObject(String string) should be used if the string is all ready encrypted. This method is used for creating new LiteralStringObject's that are created post document parse.
string - the initial contents of the literal string object,
unencrypted.reference - of parent PObjectsecurityManager - security manager used ot encrypt the string.public int getUnsignedInt(int start,
int offset)
getUnsignedInt in interface StringObjectstart - the begining index, inclusiveoffset - the length of bytes to processpublic int getUnsignedInt(java.lang.String data)
public java.lang.String toString()
Returns a string representation of the object. The hex data is converted to an equivalent string representation
toString in interface StringObjecttoString in class java.lang.Objectpublic java.lang.String getHexString()
Gets a hexadecimal String representation of this object's data, which is in fact, the raw data contained in this object
getHexString in interface StringObjectpublic java.lang.StringBuilder getHexStringBuffer()
Gets a hexadecimal StringBuffer representation of this object's data, which is in fact the raw data contained in this object.
getHexStringBuffer in interface StringObjectpublic java.lang.StringBuilder getLiteralStringBuffer()
Gets a literal StringBuffer representation of this object's data. The hexadecimal data is converted to an equivalent string representation
getLiteralStringBuffer in interface StringObjectpublic java.lang.String getLiteralString()
Gets a literal String representation of this object's data. The hexadecimal data is converted to an equivalent string representation.
getLiteralString in interface StringObjectpublic java.lang.StringBuilder getLiteralStringBuffer(int fontFormat,
FontFile font)
Gets a literal String representation of this object's data using the specifed font and format. The font is used to verify that the specific character codes can be rendered; if they can not, they may be removed or combined with the next character code to get a displayable character code.
getLiteralStringBuffer in interface StringObjectfontFormat - the type of font which will be used to display
the text. Valid values are CID_FORMAT and SIMPLE_FORMAT for Adobe
Composite and Simple font types respectivelyfont - font used to render the literal string data.public int getLength()
getLength in interface StringObjectpublic void setReference(Reference reference)
setReference in interface StringObjectreference - parent object reference.public Reference getReference()
getReference in interface StringObjectpublic java.lang.String getDecryptedLiteralString(SecurityManager securityManager)
getDecryptedLiteralString in interface StringObjectsecurityManager - security manager associated with parent document.public java.lang.String encryption(java.lang.String string,
boolean decrypt,
SecurityManager securityManager)
string - string to encrypt or decryptdecrypt - true to decrypt string, false otherwise;securityManager - security manager for document.