Here you can find the source of load(final File file, final String encoding)
public static String load(final File file, final String encoding) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.BufferedInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; public class Main { public static String load(final File file, final String encoding) throws IOException { InputStream is = null;/*from w ww . ja va2s.c o m*/ try { is = new FileInputStream(file); return loadFromStream(is, encoding); } finally { if (is != null) { is.close(); } } } protected static String loadFromStream(final InputStream is, final String encoding) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); BufferedInputStream bis = null; try { bis = new BufferedInputStream(is); byte[] buffer = new byte[2048]; int length = 0; while ((length = bis.read(buffer)) > 0) { baos.write(buffer, 0, length); } } finally { if (bis != null) { bis.close(); } } return baos.toString(encoding); } }