Java BufferedReader Create getReader(String path, String charEncoding)

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

Description

get Reader

License

Apache License

Declaration

public static BufferedReader getReader(String path, String charEncoding) throws UnsupportedEncodingException 

Method Source Code


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

import java.io.BufferedReader;

import java.io.FileInputStream;
import java.io.FileNotFoundException;

import java.io.InputStream;
import java.io.InputStreamReader;

import java.io.UnsupportedEncodingException;

public class Main {
    public static BufferedReader getReader(String path, String charEncoding) throws UnsupportedEncodingException {
        InputStream is = getInputStream(path);
        return new BufferedReader(new InputStreamReader(is, charEncoding));
    }/*from   w  w  w . j a v  a2  s  .co m*/

    public static BufferedReader getReader(InputStream inputStream, String charEncoding)
            throws UnsupportedEncodingException {
        return new BufferedReader(new InputStreamReader(inputStream, charEncoding));
    }

    public static InputStream getInputStream(String path) {
        try {
            return new FileInputStream(path);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        return null;
    }
}

Related

  1. getReader(String filename)
  2. getReader(String filename)
  3. getReader(String filePath, String charset)
  4. getReader(String path)
  5. getReader(String Path)
  6. getReader(String path, String charEncoding)
  7. getReaderAsString(Reader reader)
  8. getReaderText(BufferedReader reader)
  9. getStreamReader(InputStream input)