Here you can find the source of getGZIPContents(File f)
public static String getGZIPContents(File f) throws IOException
//package com.java2s; /**/*from w ww. j av a 2 s . c om*/ * * This file is part of the Persistent-HashMap library. * Copyright (C) 2010 Jamie Furness (http://www.jamierf.co.uk) * License: http://www.gnu.org/licenses/gpl.html GPL version 3 (or higher) * */ import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; import java.util.zip.GZIPInputStream; public class Main { protected static final int BUFFER_SIZE = 4096; public static String getGZIPContents(File f) throws IOException { return getStringFromReader( new BufferedReader(new InputStreamReader(new GZIPInputStream(new FileInputStream(f))))); } protected static String getStringFromReader(Reader in) throws IOException { StringBuffer outBuffer = new StringBuffer(); char[] inBuffer = new char[BUFFER_SIZE]; int read; while ((read = in.read(inBuffer, 0, BUFFER_SIZE)) != -1) outBuffer.append(inBuffer, 0, read); in.close(); return outBuffer.toString(); } }