Class ASCII85Decode

java.lang.Object
com.sun.pdfview.decode.ASCII85Decode

public class ASCII85Decode extends Object
decode ASCII85 text into a byte array.
  • Field Details

  • Constructor Details

    • ASCII85Decode

      private ASCII85Decode(ByteBuffer buf)
      initialize the decoder with byte buffer in ASCII85 format
  • Method Details

    • nextChar

      private int nextChar()
      get the next character from the input.
      Returns:
      the next character, or -1 if at end of stream
    • decode5

      private boolean decode5(ByteArrayOutputStream baos) throws PDFParseException
      decode the next five ASCII85 characters into up to four decoded bytes. Return false when finished, or true otherwise.
      Parameters:
      baos - the ByteArrayOutputStream to write output to, set to the correct position
      Returns:
      false when finished, or true otherwise.
      Throws:
      PDFParseException
    • decode

      private ByteBuffer decode() throws PDFParseException
      decode the bytes
      Returns:
      the decoded bytes
      Throws:
      PDFParseException
    • decode

      public static ByteBuffer decode(ByteBuffer buf, PDFObject params) throws PDFParseException
      decode an array of bytes in ASCII85 format.

      In ASCII85 format, every 5 characters represents 4 decoded bytes in base 85. The entire stream can contain whitespace, and ends in the characters '~>'.

      Parameters:
      buf - the encoded ASCII85 characters in a byte buffer
      params - parameters to the decoder (ignored)
      Returns:
      the decoded bytes
      Throws:
      PDFParseException