public class COSString extends COSPrimitiveObject implements Comparable
CONSTANT_CONTAINER, NULL_CONTAINER, SLOT_CONTAINER| Modifier and Type | Method and Description |
|---|---|
Object |
accept(ICOSObjectVisitor visitor)
Accept a visitor object.
|
COSString |
asString() |
byte[] |
byteValue()
The bytes that make up this string.
|
void |
clearBytes()
Reset the bytes for this
COSString. |
void |
clearString()
Reset the string value for this
COSString. |
int |
compareTo(Object o) |
static COSString |
create(byte[] bytes)
Create a
COSString from bytes. |
static COSString |
create(byte[] bytes,
String encoding)
Create a
COSString from bytes. |
static COSString |
create(String string)
Create a
COSString from string. |
static COSString |
create(String string,
String encoding)
Create a
COSString from string. |
static COSString |
createHex(byte[] bytes)
Create a
COSString from bytes in hex representation. |
static COSString |
createHex(byte[] bytes,
String encoding)
Create a
COSString from bytes in hex representation. |
static COSString |
createHex(String string)
Create a
COSString from string in hex representation. |
static COSString |
createHex(String string,
String encoding)
Create a
COSString from string in hex representation. |
static COSString |
createMultiLine(String string)
Create a
COSString from string, escaping all newlines. |
boolean |
equals(Object o) |
String |
getEncoding()
Lookup the custom encoding used by this string.
|
int |
hashCode() |
String |
hexStringValue()
Show a hex encoded representation of the strings content.
|
boolean |
isHexMode()
true if this string has to be saved as hex representation |
String |
multiLineStringValue()
A Java
String with correctly expanded newlines. |
void |
restoreState(Object object) |
Object |
saveState() |
void |
setEncoding(String encoding)
|
void |
setHexMode(boolean newHexMode)
Set the flag if this is written in hex representation
|
String |
stringValue()
The Java
String representation of the receiver |
static String |
toJavaString(String value) |
static String |
toPDFString(String value) |
addObjectListener, basicIterator, copyDeep, copyDeep, isDangling, isObjectListenerAvailable, isPrimitive, iterator, removeObjectListenerasArray, asBoolean, asDictionary, asFixed, asInteger, asName, asNull, asNumber, asStream, beConstant, beIndirect, containable, copyOptional, copyShallow, copySubGraph, dereference, getContainer, getDoc, getIndirectObject, getValueBoolean, getValueBytes, getValueFloat, getValueInteger, getValueString, harden, isIndirect, isNull, isNumber, isSwapped, mayBeSwapped, soften, toStringhandleException, isReferencepublic static COSString create(byte[] bytes)
COSString from bytes.bytes - COSStringpublic static COSString create(byte[] bytes, String encoding)
COSString from bytes.bytes - COSStringpublic static COSString create(String string)
COSString from string.string - COSStringpublic static COSString create(String string, String encoding)
COSString from string.string - COSStringpublic static COSString createHex(byte[] bytes)
COSString from bytes in hex representation.bytes - COSStringpublic static COSString createHex(byte[] bytes, String encoding)
COSString from bytes in hex representation.bytes - COSStringpublic static COSString createHex(String string)
COSString from string in hex representation.string - COSStringpublic static COSString createHex(String string, String encoding)
COSString from string in hex representation.string - COSStringpublic static COSString createMultiLine(String string)
COSString from string, escaping all newlines.string - COSStringpublic Object accept(ICOSObjectVisitor visitor) throws COSVisitorException
COSDocumentElementvisitor by "double dispatching".accept in class COSDocumentElementvisitor - The object visiting the receiver.COSVisitorException - An exception depending on the visitor semantics.public COSString asString()
public byte[] byteValue()
public void clearBytes()
public void clearString()
public int compareTo(Object o)
compareTo in interface Comparablepublic String getEncoding()
Be warned: If you use a custom encoding, there is no way for standard PDF tools to recover this information!
public String hexStringValue()
public boolean isHexMode()
true if this string has to be saved as hex representationtrue if this string has to be saved as hex
representationpublic String multiLineStringValue()
String with correctly expanded newlines.String with correctly expanded newlines.public void restoreState(Object object)
restoreState in interface de.intarsys.tools.component.ISaveStateSupportrestoreState in class COSObjectpublic Object saveState()
saveState in interface de.intarsys.tools.component.ISaveStateSupportpublic void setEncoding(String encoding)
Charset name to be used when decoding the
COSString bytes. If no encoding is present, the default PDF
conventions are used.
Be warned: If you use a custom encoding, there is no way for standard PDF tools to recover this information!
encoding - public void setHexMode(boolean newHexMode)
newHexMode - true if this is written in hex representationpublic String stringValue()
String representation of the receiverstringValue in class COSObjectString representation of the receiverCopyright © 2013 intarsys consulting GmbH. All Rights Reserved.