Class ParseOps


  • public final class ParseOps
    extends Object
    This class provides many utility methods related to parsing of stream.
    • Method Detail

      • readHex

        public static byte[] readHex​(InputByteStream buf)
                              throws IOException,
                                     PDFParseException
        Parses a hexidecimal character string into a byte array. A pair of hex characters forms the value stored in a single byte of the array. Hexidecimal strings are defined in section 3.2.3 of the PDF Reference Manual version 1.4.
        Parameters:
        buf - Buffer to parse
        Returns:
        Data corresponding to the hex string
        Throws:
        IOException
        PDFParseException - If there is a syntax error.
      • skipHex

        public static void skipHex​(InputByteStream buf)
                            throws IOException,
                                   PDFParseException
        Skips a hexidecimal character string. A pair of hex characters forms the value stored in a single byte of the array. Hexidecimal strings are defined in section 3.2.3 of the PDF Reference Manual version 1.4.
        Parameters:
        buf - Buffer to parse
        Throws:
        IOException
        PDFParseException - If there is a syntax error.
      • skipNumber

        public static void skipNumber​(byte first,
                                      InputByteStream buf)
                               throws PDFParseException,
                                      IOException
        Skips over a numerical value from the PDF byte stream. A numeric object is defined in section 3.2.2 of the PDF Reference Manual version 1.4.
        Parameters:
        buf - Byte stream to parse
        first - Starting byte to parse
        Throws:
        IOException
        PDFParseException
      • skipWhitespace

        public static byte skipWhitespace​(InputByteStream buf)
                                   throws IOException
        Skips over whitespace in the input stream. Whitespace is defined in section 3.1.1 of the PDF Reference Manual version 1.4. For the purposes of this method, comments are also considered whitespace.
        Parameters:
        buf - Buffer to parse
        Returns:
        The first non-whitespace byte encountered.
        Throws:
        IOException
      • getEndObjPos

        public static long getEndObjPos​(InputByteStream mBuf)
                                 throws IOException
        Gets the position of endobj keyword in this stream. If EOL is encountered before finding "endobj" -1 will be returned.
        Parameters:
        mBuf -
        Returns:
        long
        Throws:
        IOException