public static String readFileAsString(File file)
    {
        BufferedInputStream is = null;

        try
        {
            is = new BufferedInputStream(new FileInputStream(file));
        }
        catch (FileNotFoundException e)
        {
            throw new IllegalStateException(e);
        }

        return readStreamAsString(is);
    }
public static String readFileAsString(File file)
    {
        BufferedInputStream is = null;

        try
        {
            is = new BufferedInputStream(new FileInputStream(file));
        }
        catch (FileNotFoundException e)
        {
            throw new IllegalStateException(e);
        }

        return readStreamAsString(is);
    }
public static String readFileAsString ( File file ) { BufferedInputStream is = null ; try { is = new BufferedInputStream ( new FileInputStream ( file ) ) ; } catch ( FileNotFoundException e ) { throw new IllegalStateException ( e ) ; } return readStreamAsString ( is ) ; }
Reads a text file as a string.

@param  file The file.

@return The contents of the file.
Reads a text file as a string .