intarsys PDF library API

de.intarsys.pdf.cos
Class COSString

java.lang.Object
  extended by de.intarsys.pdf.cos.COSDocumentElement
      extended by de.intarsys.pdf.cos.COSObject
          extended by de.intarsys.pdf.cos.COSPrimitiveObject
              extended by de.intarsys.pdf.cos.COSString
All Implemented Interfaces:
ICOSExceptionHandler, de.intarsys.tools.component.ISaveStateSupport, Comparable

public class COSString
extends COSPrimitiveObject
implements Comparable

The string representation for a pdf document


Field Summary
 
Fields inherited from class de.intarsys.pdf.cos.COSObject
CONSTANT_CONTAINER, NULL_CONTAINER, SLOT_CONTAINER
 
Method Summary
 Object accept(ICOSObjectVisitor visitor)
          Accept a visitor object.
 COSString asString()
           
 byte[] byteValue()
          The bytes that make up this string.
 int compareTo(Object o)
           
static COSString create(byte[] bytes)
          Create a COSString from bytes.
static COSString create(String string)
          Create a COSString from string.
static COSString createHex(byte[] bytes)
          Create a COSString from bytes in hex representation.
static COSString createHex(String string)
          Create a COSString from string in hex representation.
static COSString createMultiLine(String string)
          Create a COSString from string, escaoing all newlines.
 boolean equals(Object o)
           
 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 setHexMode(boolean newHexMode)
          Set the flag if this is written in hex representation
 String stringValue()
          The Java String representation of the receiver
 
Methods inherited from class de.intarsys.pdf.cos.COSPrimitiveObject
addObjectListener, basicIterator, copyDeep, copyDeep, isDangling, isObjectListenerAvailable, isPrimitive, iterator, removeObjectListener
 
Methods inherited from class de.intarsys.pdf.cos.COSObject
asArray, asBoolean, asDictionary, asFixed, asInteger, asName, asNull, asNumber, asStream, beConstant, beIndirect, containable, copyOptional, copyShallow, copySubGraph, dereference, getContainer, getDoc, getIndirectObject, isIndirect, isNull, isNumber, isSwapped, toString
 
Methods inherited from class de.intarsys.pdf.cos.COSDocumentElement
handleException, isReference
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

create

public static COSString create(byte[] bytes)
Create a COSString from bytes.

Parameters:
bytes -
Returns:
The new COSString

create

public static COSString create(String string)
Create a COSString from string.

Parameters:
string -
Returns:
The new COSString

createHex

public static COSString createHex(byte[] bytes)
Create a COSString from bytes in hex representation.

Parameters:
bytes -
Returns:
The new COSString

createHex

public static COSString createHex(String string)
Create a COSString from string in hex representation.

Parameters:
string -
Returns:
The new COSString

createMultiLine

public static COSString createMultiLine(String string)
Create a COSString from string, escaoing all newlines.

Parameters:
string -
Returns:
The new COSString

accept

public Object accept(ICOSObjectVisitor visitor)
              throws COSVisitorException
Description copied from class: COSDocumentElement
Accept a visitor object. The receiver selects the correct implementation in the visitor by "double dispatching".

Specified by:
accept in class COSDocumentElement
Parameters:
visitor - The object visiting the receiver.
Returns:
Object An object depending on the visitor semantics.
Throws:
COSVisitorException - An exception depending on the visitor semantics.

asString

public COSString asString()
Overrides:
asString in class COSObject
Returns:
a COSString or null

hexStringValue

public String hexStringValue()
Show a hex encoded representation of the strings content.

Returns:
Show a hex encoded representation of the strings content.

byteValue

public byte[] byteValue()
The bytes that make up this string.

Returns:
The bytes that make up this string.

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

isHexMode

public boolean isHexMode()
true if this string has to be saved as hex representation

Returns:
true if this string has to be saved as hex representation

multiLineStringValue

public String multiLineStringValue()
A Java String with correctly expanded newlines.

Returns:
A Java String with correctly expanded newlines.

restoreState

public void restoreState(Object object)
Specified by:
restoreState in interface de.intarsys.tools.component.ISaveStateSupport
Overrides:
restoreState in class COSObject

saveState

public Object saveState()
Specified by:
saveState in interface de.intarsys.tools.component.ISaveStateSupport

setHexMode

public void setHexMode(boolean newHexMode)
Set the flag if this is written in hex representation

Parameters:
newHexMode - true if this is written in hex representation

stringValue

public String stringValue()
The Java String representation of the receiver

Overrides:
stringValue in class COSObject
Returns:
The Java String representation of the receiver

intarsys PDF library API

Copyright © 2006 intarsys consulting GmbH. All Rights Reserved.