Here you can find the source of readFileUTF8(String file)
public static String readFileUTF8(String file)
//package com.java2s; //License from project: Apache License import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; public class Main { public static String readFileUTF8(String file) { StringBuffer buffer = new StringBuffer(); try {/*from ww w. ja v a2 s. c o m*/ DataInputStream dis = new DataInputStream(new FileInputStream(file)); byte b[] = new byte[1]; while (dis.available() > 0) { dis.read(b); String s = new String(b, "UTF-8"); buffer.append(s); } dis.close(); } catch (IOException e) { e.printStackTrace(); } return buffer.toString(); } }