Java tutorial
import java.io.File; import java.io.FileInputStream; import java.io.ObjectInputStream; import java.io.Serializable; import java.util.zip.GZIPInputStream; public class Main { public static void main(String[] args) throws Exception { ObjectInputStream ois = new ObjectInputStream( new GZIPInputStream(new FileInputStream(new File("user.dat")))); User admin = (User) ois.readObject(); User foo = (User) ois.readObject(); ois.close(); System.out.println("Admin = [" + admin + "]"); System.out.println("Foo = [" + foo + "]"); } } class User implements Serializable { }