public String getString()

in src/java/org/apache/fop/render/pdf/pdfbox/PDFString.java [60:80]


    public String getString() {
        if (this.text == null) {
            String encoding = PDFDocument.ENCODING;
            int start = 0;
            if (this.binary.length > 2) {
                if (this.binary[0] == (byte)0xFF && this.binary[1] == (byte)0xFE) {
                    encoding = "UTF-16LE";
                    start = 2;
                } else if (this.binary[0] == (byte)0xFE && this.binary[1] == (byte)0xFF) {
                    encoding = "UTF-16BE";
                    start = 2;
                }
            }
            try {
                this.text = new String(this.binary, start, this.binary.length - start, encoding);
            } catch (UnsupportedEncodingException e) {
                throw new RuntimeException("Incompatible JVM: " + e.getMessage());
            }
        }
        return this.text;
    }