public static void catalog(String contentRoot, String catalogFile) {
        //TODO add support for refreshing or adding to catalog

        // Try to open the output file before spending all that time doing
        // processing, in case the file path was wrong.
        ObjectOutputStream oos = null;
        try {
            FileOutputStream fos = new FileOutputStream(catalogFile);
            BufferedOutputStream bos = new BufferedOutputStream(fos, 4096*4);
            oos = new ObjectOutputStream(bos);
        }
        catch(IOException e) {
            System.out.println("Problem openning catalogFile: " + e);
            return;
        }

        ArrayList<File> allFiles = new ArrayList<File>(1024);
//System.out.println("contentRoot: " + contentRoot);
        System.out.println("Cataloging list of PDFs...");
        File contentRootFile = new File(contentRoot);
        if (contentRootFile.isDirectory()) {
//System.out.println("Directory: " + contentRootFile);
            recursivelyCatalogPDFs(allFiles, contentRootFile);
        }
        else if (contentRootFile.isFile()) {
//System.out.println("File: " + contentRootFile);
            addFileIfIsPDF(allFiles, contentRootFile);
        }
        allFiles.trimToSize();
        System.out.println("Cataloged " + allFiles.size() + " PDF files");

        try {
            oos.writeObject(allFiles);
            oos.flush();
            oos.close();
        }
        catch(IOException e) {
            System.out.println("Problem saving catalog of PDF files: " + e);
        }
    }