org.apache.fop.render.pdf.pdfbox

## Class PDFString

- java.lang.Object
- - org.apache.fop.pdf.PDFObject
  - - org.apache.fop.render.pdf.pdfbox.PDFString

- All Implemented Interfaces:
    org.apache.fop.pdf.PDFWritable

      public class PDFString
      extends org.apache.fop.pdf.PDFObject

  Special PDF object for strings that goes beyond FOP's `PDFText` class.

- - ### Field Summary

    - ### Fields inherited from class org.apache.fop.pdf.PDFObject

      `log`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PDFString(byte[] data)` Creates a new String.
    `PDFString(java.lang.String text)` Creates a new String.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `byte[]` | `getBinary()` Returns the string as binary data.
    `java.lang.String` | `getString()` Returns the string as a Unicode string.
    `static boolean` | `isUSASCII(byte[] data)` Indicates whether the given binary data contains only US-ASCII characters.
    `int` | `output(java.io.OutputStream stream)`

    - ### Methods inherited from class org.apache.fop.pdf.PDFObject

      `contentEquals, encode, encodeBinaryToHexString, encodeString, encodeText, formatObject, getChildren, getDocument, getDocumentSafely, getGeneration, getObjectID, getObjectNumber, getParent, hasObjectNumber, makeReference, outputInline, referencePDF, setDocument, setObjectNumber, setObjectNumber, setObjectNumber, setParent, toPDF, toPDFString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PDFString

          public PDFString(java.lang.String text)

      Creates a new String.
      Parameters:
        `text` - the text

    - #### PDFString

          public PDFString(byte[] data)

      Creates a new String.
      Parameters:
        `data` - the text data as byte array

  - ### Method Detail

    - #### getString

          public java.lang.String getString()

      Returns the string as a Unicode string.
      Returns:
        the string

    - #### getBinary

          public byte[] getBinary()

      Returns the string as binary data.
      Returns:
        the binary representation

    - #### output

          public int output(java.io.OutputStream stream)
                     throws java.io.IOException

      Overrides:
        `output` in class `org.apache.fop.pdf.PDFObject`
      Throws:
        `java.io.IOException`

    - #### isUSASCII

          public static boolean isUSASCII(byte[] data)

      Indicates whether the given binary data contains only US-ASCII characters.
      Parameters:
        `data` - the binary data
      Returns:
        true if only US-ASCII data is found

Copyright 2007-2021 The Apache Software Foundation. All Rights Reserved.