Java BufferedReader Create getReader(String path)

Here you can find the source of getReader(String path)

Description

get Reader

License

Open Source License

Declaration

public static BufferedReader getReader(String path) throws IOException 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.BufferedReader;
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 static BufferedReader getReader(String path) throws IOException {
        if (path.endsWith(".gz")) {
            return new BufferedReader(new InputStreamReader(new GZIPInputStream(new FileInputStream(path))));
        }//ww  w . j av  a 2s.  co  m
        return new BufferedReader(new FileReader(path));
    }
}

Related

  1. getReader(String fileDir, String fileName, String encoding)
  2. getReader(String filename)
  3. getReader(String filename)
  4. getReader(String filename)
  5. getReader(String filePath, String charset)
  6. getReader(String Path)
  7. getReader(String path, String charEncoding)
  8. getReader(String path, String charEncoding)
  9. getReaderAsString(Reader reader)