Here you can find the source of unCompressString(final byte[] data, final String encoding)
public static String unCompressString(final byte[] data, final String encoding) throws IOException
//package com.java2s; /*// w w w .j a v a2s. com * Copyright (c) 2006-2007 Massachusetts General Hospital * All rights reserved. This program and the accompanying materials * are made available under the terms of the i2b2 Software License v1.0 * which accompanies this distribution. * * Contributors: * Kavishwar Wagholikar (kavi) * July 4, 2015 */ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.zip.GZIPInputStream; public class Main { public static String unCompressString(final byte[] data, final String encoding) throws IOException { if (data == null || data.length == 0) { return null; } else { ByteArrayInputStream bais = new ByteArrayInputStream(data); ByteArrayOutputStream buffer = new ByteArrayOutputStream(); GZIPInputStream is = new GZIPInputStream(bais); byte[] tmp = new byte[256]; while (true) { int r = is.read(tmp); if (r < 0) { break; } buffer.write(tmp, 0, r); } is.close(); byte[] content = buffer.toByteArray(); return new String(content, 0, content.length, encoding); } } }