Java examples for File Path IO:GZIP
gunzip Object
//package com.java2s; import java.io.ByteArrayInputStream; import java.io.Closeable; import java.io.IOException; import java.io.ObjectInputStream; import java.io.Serializable; import java.util.zip.GZIPInputStream; public class Main { public static Serializable gunzipObject(byte[] bytes) throws IOException, ClassNotFoundException { ByteArrayInputStream baIn = null; GZIPInputStream gzIn = null; ObjectInputStream objIn = null; try {//from ww w. j ava 2 s.com baIn = new ByteArrayInputStream(bytes); gzIn = new GZIPInputStream(baIn); objIn = new ObjectInputStream(gzIn); return (Serializable) objIn.readObject(); } finally { closeQuietly(objIn); closeQuietly(gzIn); closeQuietly(baIn); } } public static void closeQuietly(Closeable stream) { if (stream != null) { try { stream.close(); } catch (IOException e) { e.printStackTrace(); } } } }