class FDFParser extends COSParser
{
    /**
     * Constructs parser for given file using memory buffer.
     * 
     * @param source the source of the pdf to be parsed
     * 
     * @throws IOException If something went wrong.
     */
    public FDFParser(RandomAccessRead source) throws IOException
    {
        super(source);
    }

    /**
     * The initial parse will first parse only the trailer, the xrefstart and all xref tables to have a pointer (offset)
     * to all the pdf's objects. It can handle linearized pdfs, which will have an xref at the end pointing to an xref
     * at the beginning of the file. Last the root object is parsed.
     * 
     * @throws IOException If something went wrong.
     */
    private void initialParse() throws IOException
    {
        COSDictionary trailer = retrieveTrailer();
    
        COSDictionary root = trailer.getCOSDictionary(COSName.ROOT);
        if (root == null)
        {
            throw new IOException("Missing root object specification in trailer.");
        }
        initialParseDone = true;
    }

    /**
     * This will parse the stream and populate the FDFDocument object.
     *
     * @return the parsed FDFDocument
     * @throws IOException If there is an error reading from the stream or corrupt data is found.
     */
    public FDFDocument parse() throws IOException
    {<FILL_FUNCTION_BODY>}
}

         // set to false if all is processed
         boolean exceptionOccurred = true; 
         try
         {
            if (!parseFDFHeader())
            {
                throw new IOException( "Error: Header doesn't contain versioninfo" );
            }
            initialParse();
            exceptionOccurred = false;
            return new FDFDocument(document);
        }
        finally
        {
            if (exceptionOccurred && document != null)
            {
                IOUtils.closeQuietly(document);
                document = null;
            }
        }
    
<methods>public void <init>(org.apache.pdfbox.io.RandomAccessRead) throws java.io.IOException,public void <init>(org.apache.pdfbox.io.RandomAccessRead, java.lang.String, java.io.InputStream, java.lang.String) throws java.io.IOException,public void <init>(org.apache.pdfbox.io.RandomAccessRead, java.lang.String, java.io.InputStream, java.lang.String, org.apache.pdfbox.io.RandomAccessStreamCache.StreamCacheCreateFunction) throws java.io.IOException,public org.apache.pdfbox.io.RandomAccessReadView createRandomAccessReadView(long, long) throws java.io.IOException,public org.apache.pdfbox.cos.COSBase dereferenceCOSObject(org.apache.pdfbox.cos.COSObject) throws java.io.IOException,public boolean isLenient() ,public void setEOFLookupRange(int) <variables>private static final int DEFAULT_TRAIL_BYTECOUNT,private static final byte[] ENDOBJ,private static final byte[] ENDSTREAM,private static final char[] EOF_MARKER,private static final java.lang.String FDF_DEFAULT_VERSION,private static final java.lang.String FDF_HEADER,private static final Logger LOG,protected static final long MINIMUM_SEARCH_OFFSET,private static final char[] OBJ_MARKER,private static final java.lang.String PDF_DEFAULT_VERSION,private static final java.lang.String PDF_HEADER,private static final char[] STARTXREF,private static final int STRMBUFLEN,public static final java.lang.String SYSPROP_EOFLOOKUPRANGE,private org.apache.pdfbox.pdmodel.encryption.AccessPermission accessPermission,private org.apache.pdfbox.pdfparser.BruteForceParser bruteForceParser,private final Map<java.lang.Long,Map<org.apache.pdfbox.cos.COSObjectKey,org.apache.pdfbox.cos.COSBase>> decompressedObjects,private org.apache.pdfbox.pdmodel.encryption.PDEncryption encryption,private final non-sealed long fileLen,protected boolean initialParseDone,private boolean isLenient,private java.lang.String keyAlias,private java.io.InputStream keyStoreInputStream,private java.lang.String password,private int readTrailBytes,private SecurityHandler<org.apache.pdfbox.pdmodel.encryption.ProtectionPolicy> securityHandler,private final byte[] strmBuf,private boolean trailerWasRebuild,private final Map<org.apache.pdfbox.cos.COSObjectKey,java.lang.Long> xrefTable