Here you can find the source of getReader(String path)
public static BufferedReader getReader(String path) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.zip.GZIPInputStream; public class Main { public static BufferedReader getReader(String path) throws IOException { if (path.endsWith(".gz")) { return new BufferedReader(new InputStreamReader(new GZIPInputStream(new FileInputStream(path)))); }//ww w . j av a 2s. co m return new BufferedReader(new FileReader(path)); } }