code: public static String loadFile(String filename) {
          ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
          InputStream is = classLoader.getResourceAsStream(filename);
          if (is == null) {
              throw new IllegalArgumentException("Unable to locate: " + filename);
          }
          return streamToString(is, filename);
      }
docs: Reads content of UTF-8 file on classpath to String.
  
  @param filename file to read.
  @return file's content.
  @throws IllegalArgumentException if file could not be found.
  @throws IllegalStateException    if file could not be read.