Here you can find the source of decompressFromBase64(String message)
public static byte[] decompressFromBase64(String message) throws IOException
//package com.java2s; //License from project: Open Source License import javax.xml.bind.DatatypeConverter; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.zip.GZIPInputStream; public class Main { public static byte[] decompressFromBase64(String message) throws IOException { byte[] compressed = DatatypeConverter.parseBase64Binary(message); if (!isGzipped(compressed)) { return null; }//from ww w .j a v a2 s.c o m return decompress(compressed); } public static boolean isGzipped(byte[] bytes) { int head = ((int) bytes[0] & 0xff) | ((bytes[1] << 8) & 0xff00); return (GZIPInputStream.GZIP_MAGIC == head); } public static byte[] decompress(byte[] message) throws IOException { GZIPInputStream gzipIn = new GZIPInputStream(new ByteArrayInputStream(message)); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int count; while ((count = gzipIn.read(buffer)) != -1) { outputStream.write(buffer, 0, count); } gzipIn.close(); return outputStream.toByteArray(); } }