Java BufferedReader Create getBufferedReader(File file)

Here you can find the source of getBufferedReader(File file)

Description

get Buffered Reader

License

LGPL

Declaration

public static BufferedReader getBufferedReader(File file) throws FileNotFoundException, IOException 

Method Source Code


//package com.java2s;
//License from project: LGPL 

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.zip.GZIPInputStream;

public class Main {
    public static BufferedReader getBufferedReader(File file) throws FileNotFoundException, IOException {
        if (file.getName().endsWith(".gz")) {
            return new BufferedReader(new InputStreamReader(new GZIPInputStream(new FileInputStream(file))));
        } else {//from  w  w w .java2 s.  c o  m
            return new BufferedReader(new InputStreamReader(new FileInputStream(file)));
        }
    }
}

Related

  1. createBufferedReader( InputStream inputStream, String strCodepage)
  2. getBufferedReader(File file)
  3. getBufferedReader(File file, String charset)
  4. getBufferedReader(File file, String encoding)
  5. getBufferedReader(final File file)
  6. getBufferedReader(final InputStream inputstream)