piou
asked on
GZIPInputStream reading
JDK's docs are horrible for those classes!
So, GZIPing is straightforward. But unzipping?
ByteArrayOutputStream bos = new ByteArrayOutputStream();
GZIPOutputStream gos = new GZIPOutputStream(bos);
ObjectOutputStream oos = new ObjectOutputStream(gos);
oos.writeObject(data);
System.out.println("zipped size = "+bos.size());
ByteArrayInputStream bis = new ByteArrayInputStream(bos.t oByteArray ());
System.out.println("availa ble size = "+bis.available());
GZIPInputStream gis = new GZIPInputStream(bis);
ObjectInputStream ois = new ObjectInputStream(gis);
This obviously won't work. So how am I gonna get the decompressed data to the ObjectInputStream to get my object back?
So, GZIPing is straightforward. But unzipping?
ByteArrayOutputStream bos = new ByteArrayOutputStream();
GZIPOutputStream gos = new GZIPOutputStream(bos);
ObjectOutputStream oos = new ObjectOutputStream(gos);
oos.writeObject(data);
System.out.println("zipped
ByteArrayInputStream bis = new ByteArrayInputStream(bos.t
System.out.println("availa
GZIPInputStream gis = new GZIPInputStream(bis);
ObjectInputStream ois = new ObjectInputStream(gis);
This obviously won't work. So how am I gonna get the decompressed data to the ObjectInputStream to get my object back?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
No worries :-)
ASKER