Class ASHexString

All Implemented Interfaces:
Comparable

public class ASHexString extends ASString
This class represents a non-cos hex string.
  • Constructor Details

    • ASHexString

      public ASHexString(byte[] bytes)
      Constructor.
    • ASHexString

      public ASHexString(int[] numbers, int bytesToUse, int bytesToPad) throws PDFInvalidParameterException
      Construct an ASHexString from an array of integers.
      Parameters:
      numbers - numbers to use in constructing the ASHexString
      bytesToUse - number of bytes to use from each number starting with the LSB. Must be from 1 to 4.
      bytesToPad - number of bytes to pad in front of each number beyond the number of bytes taken from each number
      Throws:
      PDFInvalidParameterException - if the bytesToUse is not between 1 and 4
    • ASHexString

      public ASHexString(int[] numbers, int startIndex, int endIndex, int bytesToUse, int bytesToPad) throws PDFInvalidParameterException
      Throws:
      PDFInvalidParameterException
  • Method Details

    • getHex

      public byte[] getHex()
      Returns hex value of string as byte array.
    • write

      public void write(OutputStream outputStream) throws PDFIOException
      Writes the ASHexString in to the given OutputStream in the format expected by the PDF Spec.
      Parameters:
      outputStream - OutputStream to write to.
      Throws:
      PDFIOException
      See Also:
    • write

      public void write(OutputByteStream outputStream) throws PDFIOException
      Writes the ASHexString in to the given OutputByteStream in the format expected by the PDF Spec.
      Overrides:
      write in class ASString
      Parameters:
      outputStream - OutputStream to write to.
      Throws:
      PDFIOException
      See Also:
    • asString

      public String asString()
      Description copied from class: ASString
      Try to get a chars associated with a byte in this ASString. Note that, because ASString has no encoding, this just uses a series of heuristics to get the chars. No guarantees are made regarding the returned value other than "we tried our best". It may change over time.
      Overrides:
      asString in class ASString
    • toString

      public String toString()
      Description copied from class: ASString
      Attempts to get a unicode representation for this unencoded string. No guarantees are made about what is returned.
      Overrides:
      toString in class ASString