JAVA IO - 将对象压缩到文件和将对象从压缩文件反序列化。

FileOutputStream fos = new FileOutputStream("c:\\address.gz");
GZIPOutputStream gz = new GZIPOutputStream(fos);
ObjectOutputStream oos = new ObjectOutputStream(gz);

FileInputStream fin = new FileInputStream("c:\\address.gz");
GZIPInputStream gis = new GZIPInputStream(fin);
ObjectInputStream ois = new ObjectInputStream(gis);
address = (Address) ois.readObject();



你可能感兴趣的:(反序列化,对象序列化)