Class PDFStreamParser


  • public class PDFStreamParser
    extends BaseParser
    This will parse a PDF byte stream and extract operands and such.
    Author:
    Ben Litchfield
    • Constructor Detail

      • PDFStreamParser

        @Deprecated
        public PDFStreamParser​(PDStream stream)
                        throws java.io.IOException
        Deprecated.
        Constructor.
        Parameters:
        stream - The stream to parse.
        Throws:
        java.io.IOException - If there is an error initializing the stream.
      • PDFStreamParser

        @Deprecated
        public PDFStreamParser​(COSStream stream)
                        throws java.io.IOException
        Deprecated.
        Constructor.
        Parameters:
        stream - The stream to parse.
        Throws:
        java.io.IOException - If there is an error initializing the stream.
      • PDFStreamParser

        public PDFStreamParser​(PDContentStream contentStream)
                        throws java.io.IOException
        Constructor.
        Parameters:
        contentStream - The content stream to parse.
        Throws:
        java.io.IOException - If there is an error initializing the stream.
      • PDFStreamParser

        public PDFStreamParser​(byte[] bytes)
        Constructor.
        Parameters:
        bytes - the bytes to parse.
    • Method Detail

      • parse

        public void parse()
                   throws java.io.IOException
        This will parse all the tokens in the stream. This will close the stream when it is finished parsing. You can then access these with getTokens().
        Throws:
        java.io.IOException - If there is an error while parsing the stream.
      • getTokens

        public java.util.List<java.lang.Object> getTokens()
        This will get the tokens that were parsed from the stream by the parse() method.
        Returns:
        All of the tokens in the stream.
      • parseNextToken

        public java.lang.Object parseNextToken()
                                        throws java.io.IOException
        This will parse the next token in the stream.
        Returns:
        The next token in the stream or null if there are no more tokens in the stream.
        Throws:
        java.io.IOException - If an io error occurs while parsing the stream.
      • readOperator

        protected java.lang.String readOperator()
                                         throws java.io.IOException
        This will read an operator from the stream.
        Returns:
        The operator that was read from the stream.
        Throws:
        java.io.IOException - If there is an error reading from the stream.