Java UTF8 File Read openFileReaderUTF8(File file)

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

Description

open File Reader UTF

License

Apache License

Declaration

public static Reader openFileReaderUTF8(File file) throws FileNotFoundException 

Method Source Code

//package com.java2s;
/**//from   w  ww.j  a v  a 2  s.  c o  m
 * <p>Description: Provides methods to read / write files.</p>
 * <p>Copyright (c) 2007</p>
 * <p>License: Apache 2.0</p>
 *
 * @author Roman Stumm
 */

import java.io.*;
import java.nio.charset.Charset;

public class Main {
    public static Reader openFileReaderUTF8(File file) throws FileNotFoundException {
        return openFileReader(file, "UTF-8");
    }

    public static Reader openFileReader(File file, String encoding) throws FileNotFoundException {
        return new InputStreamReader(new FileInputStream(file), Charset.forName(encoding));
    }
}

Related

  1. getUTF8InputStreamReader(InputStream stream)
  2. getUTF8Reader(File f)
  3. loadUTF8(File file)
  4. makeUTF8Reader(InputStream inputStream)
  5. newUtf8Reader(final InputStream in)
  6. readAllLines(File inputFile)
  7. readAsUTF8(String text)
  8. readLines(File inputFile)
  9. readRawUTF8Bytes(final byte[] bytes)