class CheckpointUtils {
    public static final String SERIALIZED_CLASS_SUFFIX = ".serialized";
    
    public static File getBdbSubDirectory(File checkpointDir) {
        return new File(checkpointDir, "bdbje-logs");
    }
    
    public static File getClassCheckpointFile(File checkpointDir,
            final String suffix, Class<?> c) {
        return new File(checkpointDir, getClassCheckpointFilename(c, suffix));
    }
    
    public static File getClassCheckpointFile(File checkpointDir, Class<?> c) {
        return new File(checkpointDir, getClassCheckpointFilename(c, null));
    }
    
    public static String getClassCheckpointFilename(final Class<?> c) {
        return getClassCheckpointFilename(c, null);
    }
    
    public static String getClassCheckpointFilename(final Class<?> c,
            final String suffix) {
        return c.getName() + ((suffix == null)? "": "." + suffix) +
            SERIALIZED_CLASS_SUFFIX;
    }
    
    /**
     * Utility function to serialize an object to a file in current checkpoint
     * dir. Facilities
     * to store related files alongside the serialized object in a directory
     * named with a <code>.auxiliary</code> suffix.
     *
     * @param o Object to serialize.
     * @param dir Directory to serialize into.
     * @throws IOException
     */
    public static void writeObjectToFile(final Object o, final File dir)
    throws IOException {
        writeObjectToFile(o, null, dir);
    }
        
    public static void writeObjectToFile(final Object o, final String suffix,
            final File dir)
    throws IOException {
        FileUtils.ensureWriteableDirectory(dir);
        ObjectOutputStream out = new ObjectOutputStream(
            new FileOutputStream(getClassCheckpointFile(dir, suffix,
                o.getClass())));
        try {
            out.writeObject(o);
        } finally {
            out.close();
        }
    }
    
    public static <T> T readObjectFromFile(final Class<T> c, final File dir)
    throws FileNotFoundException, IOException, ClassNotFoundException {
        return readObjectFromFile(c, null, dir);
    }
    
    public static <T> T readObjectFromFile(final Class<T> c, final String suffix,
            final File dir)
    throws FileNotFoundException, IOException, ClassNotFoundException {<FILL_FUNCTION_BODY>}

    /**
     * @return Instance of filename filter that will let through files ending
     * in '.jdb' (i.e. bdb je log files).
     */
    public static FilenameFilter getJeLogsFilter() {
        return new FilenameFilter() {
            public boolean accept(File dir, String name) {
                return name != null && name.toLowerCase().endsWith(".jdb");
            }
        };
    }
}

        ObjectInputStream in = new ObjectInputStream(
            new FileInputStream(getClassCheckpointFile(dir, suffix, c)));
        T o = null;
        try {
            o = c.cast(in.readObject());
        } finally {
            in.close();
        }
        return o;
    
<no_super_class>