public static String readFileToString(final File file, final Charset encoding) throws IOException {
        InputStream in = null;
        try {
            in = openInputStream(file);
            return IOUtils.toString(in, Charsets.toCharset(encoding));
        } finally {
            CloseableUtils.closeQuietly(in);
        }
    }
Reads the contents of a file into a String.
The file is always closed.

@param file     the file to read, must not be {@code null}
@param encoding the encoding to use, {@code null} means platform default
@return the file contents, never {@code null}
@throws IOException in case of an I/O error
replugin-host-library/replugin-host-lib/src/main/java/com/qihoo360/replugin/utils/FileUtils.java