Java Path File Read nio readFile(String path)

Here you can find the source of readFile(String path)

Description

read File

License

Apache License

Declaration

public static void readFile(String path) throws IOException 

Method Source Code


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

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

public class Main {
    final static Charset UTF8 = Charset.forName("UTF-8");

    public static void readFile(String path) throws IOException {
        Reader reader = new InputStreamReader(new FileInputStream(path), UTF8);
        try {//from   ww w  .  j av  a 2 s  . co m
            int c = reader.read();
            System.out.println(c);
        } finally {
            reader.close();
        }
    }
}

Related

  1. readFile(Path path)
  2. readFile(Path path)
  3. readFile(String path)
  4. readFile(String path)
  5. readFile(String path)
  6. readFile(String path)
  7. readFileAsString(String filePath)
  8. readFileAsString(String path)
  9. readFileByLines(String filePath)