private void parseFile(PDFPassword password) throws IOException {
        // start at the begining of the file
        fileBuf.rewind();
        String versionLine = readLine(fileBuf);
        if (versionLine.startsWith(VERSION_COMMENT)) {
            processVersion(versionLine.substring(VERSION_COMMENT.length()));
        }
        fileBuf.rewind();

        fileBuf.position(fileBuf.limit() - 1);
        if (!backscan(fileBuf, "startxref")) {
            throw new PDFParseException("This may not be a PDF File");
        }
        int postStartXrefPos = fileBuf.position();


        // ensure that we've got at least one piece of whitespace here, which
        // should be a carriage return
        if (!isWhiteSpace(fileBuf.get())) {
            throw new PDFParseException("Found suspicious startxref without " +
                    "trialing whitespace");
        }

        final StringBuilder xrefBuf = new StringBuilder();
        char c = (char) nextNonWhitespaceChar(fileBuf);
        while (c >= '0' && c <= '9')  {
            xrefBuf.append(c);
            c = (char) fileBuf.get();
        }

        int xrefpos = Integer.parseInt(xrefBuf.toString());
        fileBuf.position(xrefpos);

        try {
            readTrailersAndXrefs(password);
        } catch (UnsupportedEncryptionException e) {
            throw new PDFParseException(e.getMessage(), e);
        }
    }