code: public static String readFileToString(File file, Charset charset) throws IOException {
      InputStream in = null;
      try {
        in = new FileInputStream(file);
        StringBuilderWriter sw = new StringBuilderWriter();
  
        if (null == charset) IOs.copy(new InputStreamReader(in), sw);
        else IOs.copy(new InputStreamReader(in, charset.name()), sw);
  
        return sw.toString();
      } finally {
        IOs.close(in);
      }
    }
docs: Reads the contents of a file into a String.
  The file is always closed.