Java File to Reader newReader(File file, String charset)

Here you can find the source of newReader(File file, String charset)

Description

new Reader

License

LGPL

Declaration

public static Reader newReader(File file, String charset) throws IOException 

Method Source Code

//package com.java2s;
/*/* w  ww . j  a v  a2 s . c  o  m*/
 * MoXie (SysTem128@GMail.Com) 2009-3-26 20:21:08
 * 
 * Copyright © 2008-2009 Zoeey.Org
 * Code license: GNU Lesser General Public License Version 3
 * http://www.gnu.org/licenses/lgpl-3.0.txt
 */

import java.io.File;
import java.io.FileInputStream;

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

import java.io.Reader;

public class Main {

    public static Reader newReader(File file, String charset) throws IOException {
        return new InputStreamReader(new FileInputStream(file), charset);
    }

    public static Reader newReader(InputStream is, String charset) throws IOException {
        return new InputStreamReader(is, charset);
    }
}

Related

  1. newReader(File file)
  2. newReader(File file, String encoding)
  3. newReader(File pathname)
  4. newReader(String value)
  5. openReader(File file)