COSObjectable
public class COSString extends COSBase
Modifier and Type | Field | Description |
---|---|---|
static byte[] |
BS_ESCAPE |
BS escape characters.
|
static byte[] |
CR_ESCAPE |
CR escape characters.
|
static byte[] |
ESCAPE |
the escape character in strings.
|
static byte[] |
FF_ESCAPE |
FF escape characters.
|
static byte[] |
HEX_STRING_CLOSE |
One of the close string tokens.
|
static byte[] |
HEX_STRING_OPEN |
One of the open string tokens.
|
static byte[] |
HT_ESCAPE |
HT escape characters.
|
static byte[] |
LF_ESCAPE |
LF escape characters.
|
static byte[] |
STRING_CLOSE |
One of the close string tokens.
|
static byte[] |
STRING_OPEN |
One of the open string tokens.
|
Constructor | Description |
---|---|
COSString() |
Constructor.
|
COSString(boolean isDictionaryValue) |
Deprecated.
Not needed anymore.
|
COSString(byte[] value) |
Explicit constructor for ease of manual PDF construction.
|
COSString(java.lang.String value) |
Explicit constructor for ease of manual PDF construction.
|
Modifier and Type | Method | Description |
---|---|---|
java.lang.Object |
accept(ICOSVisitor visitor) |
visitor pattern double dispatch method.
|
void |
append(byte[] data) |
This will append a byte[] to the string.
|
void |
append(int in) |
This will append a byte to the string.
|
static COSString |
createFromHexString(java.lang.String hex) |
This will create a COS string from a string of hex characters.
|
static COSString |
createFromHexString(java.lang.String hex,
boolean force) |
Creates a COS string from a string of hex characters, optionally ignoring malformed input.
|
boolean |
equals(java.lang.Object obj) |
|
byte[] |
getBytes() |
This will get the bytes of the string.
|
java.lang.String |
getHexString() |
This will take this string and create a hex representation of the bytes that make the string.
|
java.lang.String |
getString() |
This will get the string that this object wraps.
|
int |
hashCode() |
|
void |
reset() |
This will reset the internal buffer.
|
void |
setForceHexForm(boolean v) |
Forces the string to be written in hexadecimal form instead of literal form.
|
void |
setForceLiteralForm(boolean v) |
Forces the string to be written in literal form instead of hexadecimal form.
|
java.lang.String |
toString() |
|
void |
writePDF(java.io.OutputStream output) |
This will output this string as a PDF object.
|
getCOSObject, getFilterManager, isDirect, isNeedToBeUpdate, setDirect, setNeedToBeUpdate
public static final byte[] STRING_OPEN
public static final byte[] STRING_CLOSE
public static final byte[] HEX_STRING_OPEN
public static final byte[] HEX_STRING_CLOSE
public static final byte[] ESCAPE
public static final byte[] CR_ESCAPE
public static final byte[] LF_ESCAPE
public static final byte[] HT_ESCAPE
public static final byte[] BS_ESCAPE
public static final byte[] FF_ESCAPE
public COSString()
@Deprecated public COSString(boolean isDictionaryValue)
COSString()
instead. PDFBOX-1437isDictionaryValue
- determines if this string represents a dictionarypublic COSString(java.lang.String value)
value
- The string value of the object.public COSString(byte[] value)
value
- The string value of the object.public void setForceLiteralForm(boolean v)
v
- if v is true the string will be written in literal form, otherwise it will be written in hexa if
necessary.public void setForceHexForm(boolean v)
v
- if v is true the string will be written in hexadecimal form otherwise it will be written in literal if
necessary.public static COSString createFromHexString(java.lang.String hex) throws java.io.IOException
hex
- A hex string.java.io.IOException
- If there is an error with the hex string.public static COSString createFromHexString(java.lang.String hex, boolean force) throws java.io.IOException
hex
- A hex string.force
- flag to ignore malformed inputjava.io.IOException
- If there is an error with the hex string.public java.lang.String getHexString()
public java.lang.String getString()
public void append(byte[] data) throws java.io.IOException
data
- The byte[] to add to this string.java.io.IOException
- If an IO error occurs while writing the byte.public void append(int in) throws java.io.IOException
in
- The byte to add to this string.java.io.IOException
- If an IO error occurs while writing the byte.public void reset()
public byte[] getBytes()
public java.lang.String toString()
toString
in class java.lang.Object
public void writePDF(java.io.OutputStream output) throws java.io.IOException
output
- The stream to write to.java.io.IOException
- If there is an error writing to the stream.public java.lang.Object accept(ICOSVisitor visitor) throws COSVisitorException
accept
in class COSBase
visitor
- The object to notify when visiting this object.COSVisitorException
- If an error occurs while visiting this object.public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object