Here you can find the source of decompressStringFromByteArray(byte[] compressedString)
public static String decompressStringFromByteArray(byte[] compressedString)
//package com.java2s; //License from project: Open Source License import java.io.*; import java.util.zip.GZIPInputStream; public class Main { public static String decompressStringFromByteArray(byte[] compressedString) { StringBuilder stringBuilder = new StringBuilder(); try {//from ww w . j a v a2s. c o m GZIPInputStream gzipInputStream = new GZIPInputStream(new ByteArrayInputStream(compressedString)); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(gzipInputStream, "UTF-8")); String line; while ((line = bufferedReader.readLine()) != null) { stringBuilder.append(line); } } catch (IOException e) { e.printStackTrace(); } return stringBuilder.toString(); } }