Compress serialized object in GZIP format into file
FileOutputStream fos = new FileOutputStream("c:\\address.gz");
GZIPOutputStream gz = new GZIPOutputStream(fos);
ObjectOutputStream oos = new ObjectOutputStream(gz);
oos.writeObject(address);
oos.close();
Decompress serialized object from a Gzip file
FileInputStream fin = new FileInputStream("c:\\address.gz");
GZIPInputStream gis = new GZIPInputStream(fin);
ObjectInputStream ois = new ObjectInputStream(gis);
Address address = (Address) ois.readObject();
ois.close();
No comments:
Post a Comment
Note: only a member of this blog may post a comment.