Here you can find the source of loadUTF8(File file)
public static String loadUTF8(File file) throws IOException
//package com.java2s; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; public class Main { public static String loadUTF8(File file) throws IOException { FileInputStream is = new FileInputStream(file); try {/*from w w w. j a va 2 s . c o m*/ byte[] buf = new byte[1024]; ByteArrayOutputStream bos = new ByteArrayOutputStream(); while (true) { int read = is.read(buf); if (read == -1) break; bos.write(buf, 0, read); } return new String(bos.toByteArray(), "UTF-8"); } finally { is.close(); } } }