Class ASString
java.lang.Object
com.adobe.internal.pdftoolkit.core.types.ASObject
com.adobe.internal.pdftoolkit.core.types.ASString
- All Implemented Interfaces:
Comparable
- Direct Known Subclasses:
ASHexString
Represents a pdf string object. That is, a series of bytes that do NOT have an associated encoding.
-
Constructor Summary
ConstructorsConstructorDescriptionASString(byte[] bytes) ASString(int[] numbers, int bytesToUse, int bytesToPad) Construct anASStringfrom an array of integers.ASString(int[] numbers, int startIndex, int endIndex, int bytesToUse, int bytesToPad) Creates an ASString that contains UTF-8.ASString(String javaString, CharsetEncoder cse) Creates an ASString that contains the bytes received by encoding the javaString with the provided cse. -
Method Summary
Modifier and TypeMethodDescriptionasString()Try to get a chars associated with a byte in this ASString.intbooleanbooleanbyte[]getBytes()Get the raw bytes associated with this ASString.chargetChar(int index) Try to get a chars associated with a byte in this ASString.char[]getChars()Try to get an array of chars associated with this ASString.inthashCode()intindexOf(byte[] key) intlastIndexOf(int target) substring(int begin) substring(int begin, int end) toString()Attempts to get a unicode representation for this unencoded string.voidwrite(OutputByteStream outputByteStream) Writes the ASString in to the given OutputStream in the format expected by the PDF Spec.
-
Constructor Details
-
ASString
public ASString(byte[] bytes) -
ASString
Creates an ASString that contains UTF-8. Note that the fact that this is UTF-8 is promptly forgotten by the instance. -
ASString
Creates an ASString that contains the bytes received by encoding the javaString with the provided cse. Note that the encoding is promptly forgotten by the instance.- Throws:
PDFInvalidParameterException
-
ASString
Construct anASStringfrom an array of integers.- Parameters:
numbers- numbers to use in constructing the ASStringbytesToUse- number of bytes to use from each number starting with the LSB. Must be from 1 to 4.bytesToPad- number of bytes to pad in front of each number beyond the number of bytes taken from each number- Throws:
PDFInvalidParameterException- if the bytesToUse is not between 1 and 4
-
ASString
public ASString(int[] numbers, int startIndex, int endIndex, int bytesToUse, int bytesToPad) throws PDFInvalidParameterException - Throws:
PDFInvalidParameterException
-
-
Method Details
-
getBytes
public byte[] getBytes()Get the raw bytes associated with this ASString. The client must NOT alter the returned array. -
getChars
public char[] getChars()Try to get an array of chars associated with this ASString. Note that, because ASString has no encoding, this just uses a series of heuristics to get the chars. No guarantees are made regarding the returned value other than "we tried our best". It may change over time. -
getChar
public char getChar(int index) Try to get a chars associated with a byte in this ASString. Note that, because ASString has no encoding, this just uses a series of heuristics to get the chars. No guarantees are made regarding the returned value other than "we tried our best". It may change over time. -
asString
Try to get a chars associated with a byte in this ASString. Note that, because ASString has no encoding, this just uses a series of heuristics to get the chars. No guarantees are made regarding the returned value other than "we tried our best". It may change over time. -
toString
Attempts to get a unicode representation for this unencoded string. No guarantees are made about what is returned. -
compareTo
- Specified by:
compareToin interfaceComparable
-
equals
-
equals
-
hashCode
public int hashCode() -
indexOf
public int indexOf(byte[] key) -
lastIndexOf
public int lastIndexOf(int target) -
substring
-
substring
-
concat
-
write
Writes the ASString in to the given OutputStream in the format expected by the PDF Spec.- Specified by:
writein classASObject- Parameters:
outputByteStream- OutputByteStream to write to.- Throws:
PDFIOException- See Also:
-