Java examples for File Path IO:GZIP
Compresses a byte array gzip
import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.zip.GZIPInputStream; import java.util.zip.GZIPOutputStream; public class Main{ /**//from w w w . j ava2 s. com * Compresses a byte array */ public static byte[] uncompress(byte[] theBytes) throws IOException { ByteArrayInputStream bis = new ByteArrayInputStream(theBytes); GZIPInputStream gos = new GZIPInputStream(bis); ByteArrayOutputStream bos = new ByteArrayOutputStream(); IOUtils.copy(gos, bos); return bos.toByteArray(); } }