将对象序列化到文件
import java.awt.Color;// 来自 时 代 J a v a 公 众 号 import java.awt.image.BufferedImage; import java.io.*; import java.util.ArrayList; import java.util.logging.*; public class Main{ /** * Serialize an object to a file * @param object The object to serialize. * @param filename The filename of the serialized object */ public static void serializeObject(Object object, String filename) { System.out.println("Serializing " + filename); try { FileOutputStream fileOut = new FileOutputStream(filename); ObjectOutputStream out = new ObjectOutputStream(fileOut); out.writeObject(object); out.close(); fileOut.close(); } catch (IOException ex) { Logger.getLogger(HelperFunctions.