使用gzip算法解压缩数据字节。
/* 来 自 nowjava - 时 代 Java*/ //package com.nowjava; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.zip.GZIPInputStream; public class Main { /** * Decompress data bytes with gzip algorithm. * * @param data * @return data decompressed. * @throws IOException */ public static byte[] ungzip(byte[] data) throws IOException { if (data == null) { return data; } ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayInputStream in = new ByteArrayInputStream(data); GZIPInputStream gis = null; try { gis = new GZIPInputStream(in); /** 来 自 时 代 J a v a - nowjava.com **/ byte[] buffer = new byte[1024]; int n; while ((n = gis.read(buffer)) >=