public static String readFileToString(File file, final Charset charset) throws IOException {
        String line = null;
        BufferedReader reader = getBufferReader(file, charset);
        StringBuffer strBuffer = new StringBuffer();

        while ((line = reader.readLine()) != null) {
            strBuffer.append(line);
        }
        return strBuffer.toString();
    }
public static String readFileToString ( File file , final Charset charset ) throws IOException { String line = null ; BufferedReader reader = getBufferReader ( file , charset ) ; StringBuffer strBuffer = new StringBuffer ( ) ; while ( ( line = reader . readLine ( ) ) != null ) { strBuffer . append ( line ) ; } return strBuffer . toString ( ) ; }
Read file to string string.

@param file    the file
@param charset the charset
@return the string
@throws IOException the io exception