Here you can find the source of readFile(String path)
public static void readFile(String path) throws IOException
//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(); } } }