org.pdfbox.cos
Class COSString
- COSObjectable
This represents a string object in a PDF document.
COSString() - Constructor.
|
COSString(String value) - Explicit constructor for ease of manual PDF construction.
|
COSString(byte[] value) - Explicit constructor for ease of manual PDF construction.
|
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(String hex) - This will create a COS string from a string of hex characters.
|
boolean | equals(Object obj) -
|
byte[] | getBytes() - This will get the bytes of the string.
|
String | getHexString() - This will take this string and create a hex representation of the bytes that make the string.
|
String | getString() - This will get the string that this object wraps.
|
int | hashCode() -
|
void | reset() - This will reset the internal buffer.
|
void | setForceLiteralForm(boolean v) - Forces the string to be written in literal form instead of hexadecimal form.
|
String | toString() -
|
void | writePDF(OutputStream output) - This will output this string as a PDF object.
|
BS_ESCAPE
public static final byte[] BS_ESCAPE
BS escape characters.
CR_ESCAPE
public static final byte[] CR_ESCAPE
CR escape characters.
ESCAPE
public static final byte[] ESCAPE
the escape character in strings.
FF_ESCAPE
public static final byte[] FF_ESCAPE
FF escape characters.
HEX_STRING_CLOSE
public static final byte[] HEX_STRING_CLOSE
One of the close string tokens.
HEX_STRING_OPEN
public static final byte[] HEX_STRING_OPEN
One of the open string tokens.
HT_ESCAPE
public static final byte[] HT_ESCAPE
HT escape characters.
LF_ESCAPE
public static final byte[] LF_ESCAPE
LF escape characters.
STRING_CLOSE
public static final byte[] STRING_CLOSE
One of the close string tokens.
STRING_OPEN
public static final byte[] STRING_OPEN
One of the open string tokens.
COSString
public COSString()
Constructor.
COSString
public COSString(String value)
Explicit constructor for ease of manual PDF construction.
value
- The string value of the object.
COSString
public COSString(byte[] value)
Explicit constructor for ease of manual PDF construction.
value
- The string value of the object.
accept
public Object accept(ICOSVisitor visitor)
throws COSVisitorException
visitor pattern double dispatch method.
- accept in interface COSBase
visitor
- The object to notify when visiting this object.
- any object, depending on the visitor implementation, or null
append
public void append(byte[] data)
throws IOException
This will append a byte[] to the string.
data
- The byte[] to add to this string.
append
public void append(int in)
throws IOException
This will append a byte to the string.
in
- The byte to add to this string.
createFromHexString
public static COSString createFromHexString(String hex)
throws IOException
This will create a COS string from a string of hex characters.
- A cos string with the hex characters converted to their actual bytes.
equals
public boolean equals(Object obj)
getBytes
public byte[] getBytes()
This will get the bytes of the string.
- A byte array that represents the string.
getHexString
public String getHexString()
This will take this string and create a hex representation of the bytes that make the string.
- A hex string representing the bytes in this string.
getString
public String getString()
This will get the string that this object wraps.
hashCode
public int hashCode()
reset
public void reset()
This will reset the internal buffer.
setForceLiteralForm
public void setForceLiteralForm(boolean v)
Forces the string to be written in literal form instead of hexadecimal form.
v
- if v is true the string will be written in literal form, otherwise it will
be written in hexa if necessary.
toString
public String toString()
writePDF
public void writePDF(OutputStream output)
throws IOException
This will output this string as a PDF object.
output
- The stream to write to.