code: public static File writeObjectToFileNoExceptions(Object o, String filename) {
      File file = null;
      ObjectOutputStream oos = null;
      try {
        file = new File(filename);
        // file.createNewFile(); // cdm may 2005: does nothing needed
        oos = new ObjectOutputStream(new BufferedOutputStream(
            new GZIPOutputStream(new FileOutputStream(file))));
        oos.writeObject(o);
        oos.close();
      } catch (Exception e) {
        e.printStackTrace();
      } finally {
        closeIgnoringExceptions(oos);
      }
      return file;
    }
docs: Write object to a file with the specified name.
  
  @param o
  object to be written to file
  @param filename
  name of the temp file
  
  @return File containing the object, or null if an exception was caught