Here you can find the source of getBufferedReader(File file)
public static BufferedReader getBufferedReader(File file) throws FileNotFoundException, IOException
//package com.java2s; //License from project: LGPL import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import java.util.zip.GZIPInputStream; public class Main { public static BufferedReader getBufferedReader(File file) throws FileNotFoundException, IOException { if (file.getName().endsWith(".gz")) { return new BufferedReader(new InputStreamReader(new GZIPInputStream(new FileInputStream(file)))); } else {//from w w w .java2 s. c o m return new BufferedReader(new InputStreamReader(new FileInputStream(file))); } } }