| Method from com.lowagie.text.pdf.PdfString Detail: |
void decrypt(PdfReader reader) {
PdfEncryption decrypt = reader.getDecrypt();
if (decrypt != null) {
originalValue = value;
decrypt.setHashKey(objNum, objGen);
bytes = PdfEncodings.convertToBytes(value, null);
bytes = decrypt.decryptByteArray(bytes);
value = PdfEncodings.convertToString(bytes, null);
}
}
|
public byte[] getBytes() {
if (bytes == null) {
if (encoding != null && encoding.equals(TEXT_UNICODE) && PdfEncodings.isPdfDocEncoding(value))
bytes = PdfEncodings.convertToBytes(value, TEXT_PDFDOCENCODING);
else
bytes = PdfEncodings.convertToBytes(value, encoding);
}
return bytes;
}
|
public String getEncoding() {
return encoding;
}
Gets the encoding of this string. |
public byte[] getOriginalBytes() {
if (originalValue == null)
return getBytes();
return PdfEncodings.convertToBytes(originalValue, null);
}
|
public boolean isHexWriting() {
return hexWriting;
}
|
public PdfString setHexWriting(boolean hexWriting) {
this.hexWriting = hexWriting;
return this;
}
|
void setObjNum(int objNum,
int objGen) {
this.objNum = objNum;
this.objGen = objGen;
}
|
public void toPdf(PdfWriter writer,
OutputStream os) throws IOException {
byte b[] = getBytes();
PdfEncryption crypto = null;
if (writer != null)
crypto = writer.getEncryption();
if (crypto != null && !crypto.isEmbeddedFilesOnly()) {
b = crypto.encryptByteArray(b);
}
if (hexWriting) {
ByteBuffer buf = new ByteBuffer();
buf.append('< ");
int len = b.length;
for (int k = 0; k < len; ++k)
buf.appendHex(b[k]);
buf.append(' >");
os.write(buf.toByteArray());
}
else
os.write(PdfContentByte.escapeString(b));
}
Returns the PDF representation of this PdfString. |
public String toString() {
return value;
}
Returns the String value of the PdfString-object. |
public String toUnicodeString() {
if (encoding != null && encoding.length() != 0)
return value;
getBytes();
if (bytes.length >= 2 && bytes[0] == (byte)254 && bytes[1] == (byte)255)
return PdfEncodings.convertToString(bytes, PdfObject.TEXT_UNICODE);
else
return PdfEncodings.convertToString(bytes, PdfObject.TEXT_PDFDOCENCODING);
}
|