Here you can find the source of getFileReader(File file)
public synchronized static BufferedReader getFileReader(File file) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.File; 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 synchronized static BufferedReader getFileReader(File file) throws IOException { return file.getName().endsWith(".gz") ? new BufferedReader( new InputStreamReader(new GZIPInputStream( new FileInputStream(file)))) : new BufferedReader( new FileReader(file)); }//from w ww. ja v a2 s. c om public synchronized static BufferedReader getFileReader(String fileName) throws IOException { return getFileReader(new File(fileName)); } }