Here you can find the source of getBufferedReader(String filename, String encoding)
public static BufferedReader getBufferedReader(String filename, String encoding) throws FileNotFoundException, IOException
//package com.java2s; //License from project: Apache License import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.zip.GZIPInputStream; public class Main { public static final String GZIP_FILENAME_EXTENSION = ".gz"; public static BufferedReader getBufferedReader(String filename, String encoding) throws FileNotFoundException, IOException { if (filename.endsWith(GZIP_FILENAME_EXTENSION)) return new BufferedReader(new InputStreamReader( (InputStream) new GZIPInputStream(new FileInputStream(filename)), encoding)); else/* w ww . jav a2 s . c o m*/ return new BufferedReader(new InputStreamReader((InputStream) new FileInputStream(filename), encoding)); } }