Here you can find the source of getReader(String filename)
public static BufferedReader getReader(String filename)
//package com.java2s; // This software is released under the 2-clause BSD license. import java.io.*; import java.util.zip.*; public class Main { public static final String DEFAULT_ENCODING = "UTF-8"; public static BufferedReader getReader(String filename) { return getReader(filename, "UTF-8"); }/*from ww w . j ava 2 s. c om*/ public static BufferedReader getReader(String filename, String encoding) { return getReader(new File(filename), encoding); } public static BufferedReader getReader(File input) { return getReader(input, DEFAULT_ENCODING); } public static BufferedReader getReader(File input, String encoding) { try { InputStream is = new FileInputStream(input); if (input.getName().endsWith(".gz")) is = new GZIPInputStream(is); return new BufferedReader(new InputStreamReader(is, encoding)); } catch (IOException e) { throw new RuntimeException(e); } } }