Here you can find the source of loadAsString(String locationPattern, Charset encoding)
public static String loadAsString(String locationPattern, Charset encoding) throws IOException
//package com.java2s; //License from project: Apache License import java.io.IOException; import java.net.URL; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import com.google.common.io.Resources; public class Main { public static String loadAsString(String locationPattern, Charset encoding) throws IOException { URL url = Resources.getResource(locationPattern); return Resources.toString(url, encoding); }/*from w w w. j a v a 2 s .c om*/ public static String loadAsString(String locationPattern) throws IOException { return loadAsString(locationPattern, StandardCharsets.UTF_8); } }