code: public static BufferedReader getBufferedReader(final File f) throws IOException {
          BufferedReader br = null;
          if ((f == null) || (!f.isFile())) {
              return br;
          }
          if (f.getName().endsWith(".gz") || f.getName().endsWith(".zip") || f.getName().endsWith(".tgz")) {
              br = new BufferedReader(new InputStreamReader(new GZIPInputStream(new FileInputStream(f)), "UTF-8"));
          } else {
              br = new BufferedReader(new InputStreamReader(new FileInputStream(f), "UTF-8"));
          }
          return br;
      }
docs: Obtains an instance of BufferedReader depending on the file extension: if
  it ends with gz, zip, or tgz then a compressed reader is used instead of
  the standard one.
  
  @param f The file to be opened.
  @return An instance of BufferedReader or null if there is a problem
  @throws IOException when the file cannot be read.
  @see BufferedReader