public static String readFileToString(File file){
  if (file == null) {
    return null;
  }
  BufferedReader reader=null;
  try {
    reader=new BufferedReader(new FileReader(file));
    StringBuilder fileContents=new StringBuilder("");
    boolean isFirstLine=true;
    String currentLine=reader.readLine();
    while (currentLine != null) {
      if (isFirstLine)       isFirstLine=false;
 else       fileContents.append(System.lineSeparator());
      fileContents.append(currentLine);
      currentLine=reader.readLine();
    }
    return fileContents.toString();
  }
 catch (  Exception e) {
    logger.debug(e.toString() + System.lineSeparator() + StackTrace.getStringFromStackTrace(e));
    return null;
  }
 finally {
    try {
      if (reader != null) {
        reader.close();
      }
    }
 catch (    Exception e) {
      logger.debug(e.toString() + System.lineSeparator() + StackTrace.getStringFromStackTrace(e));
    }
  }
}

public static String readFileToString ( File file ) { if ( file == null ) { return null ; } BufferedReader reader = null ; try { reader = new BufferedReader ( new FileReader ( file ) ) ; StringBuilder fileContents = new StringBuilder ( "" ) ; boolean isFirstLine = true ; String currentLine = reader . readLine ( ) ; while ( currentLine != null ) { if ( isFirstLine ) isFirstLine = false ; else fileContents . append ( System . lineSeparator ( ) ) ; fileContents . append ( currentLine ) ; currentLine = reader . readLine ( ) ; } return fileContents . toString ( ) ; } catch ( Exception e ) { logger . debug ( e . toString ( ) + System . lineSeparator ( ) + StackTrace . getStringFromStackTrace ( e ) ) ; return null ; } finally { try { if ( reader != null ) { reader . close ( ) ; } } catch ( Exception e ) { logger . debug ( e . toString ( ) + System . lineSeparator ( ) + StackTrace . getStringFromStackTrace ( e ) ) ; } } }
this is a quiet method .
