Java Text File Read by Charset readerBuffered(final File file, final Charset charset)

Here you can find the source of readerBuffered(final File file, final Charset charset)

Description

Open a buffered Reader , equivalent to:
new BufferedReader(new InputStreamReader(new FileInputStream(file), charset));

License

Open Source License

Parameter

Parameter Description
file the file to open
charset the charset to decode the file contents

Exception

Parameter Description
FileNotFoundException if the file could not be opened

Return

the buffered reader from the file

Declaration

public static final BufferedReader readerBuffered(final File file, final Charset charset)
        throws FileNotFoundException 

Method Source Code

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

import java.io.BufferedReader;

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

import java.io.InputStreamReader;

import java.nio.charset.Charset;

public class Main {
    /** Open a buffered {@link Reader}, equivalent to:<br/>
     * {@code new BufferedReader(new InputStreamReader(new FileInputStream(file), charset));}
     * @param file the file to open/* w ww  .j a v a2 s.  c  om*/
     * @param charset the charset to decode the file contents
     * @return the buffered reader from the file
     * @throws FileNotFoundException if the file could not be opened
     */
    public static final BufferedReader readerBuffered(final File file, final Charset charset)
            throws FileNotFoundException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), charset));
        return reader;
    }
}

Related

  1. readAsString(InputStream in, Charset charset)
  2. readAsString(InputStream is, CharsetDecoder decoder)
  3. readCharsWithEncoding(File file, Charset charset)
  4. reader(Class baseClass, String resourceName, Charset charset)
  5. reader(InputStream in, String charsetName)
  6. readFile(Bundle bundle, String path, Charset cs)
  7. readFile(File f, Charset chst)
  8. readFile(File file, Charset charset)
  9. readFile(File file, Charset charset)