private static String contentsOfFile(WeakReference<Context> weakContext,String filename){
  Context context=null;
  if (weakContext != null) {
    context=weakContext.get();
    if (context != null) {
      StringBuilder contents=new StringBuilder();
      BufferedReader reader=null;
      try {
        File file=new File(filename);
        reader=new BufferedReader(new FileReader(file));
        String line=null;
        while ((line=reader.readLine()) != null) {
          contents.append(line);
          contents.append(System.getProperty("line.separator"));
        }
      }
 catch (      FileNotFoundException e) {
      }
catch (      IOException e) {
        e.printStackTrace();
      }
 finally {
        IOUtils.closeQuietly(reader);
      }
      return contents.toString();
    }
  }
  return null;
}

private static String contentsOfFile ( WeakReference < Context > weakContext , String filename ) { Context context = null ; if ( weakContext != null ) { context = weakContext . get ( ) ; if ( context != null ) { StringBuilder contents = new StringBuilder ( ) ; BufferedReader reader = null ; try { File file = new File ( filename ) ; reader = new BufferedReader ( new FileReader ( file ) ) ; String line = null ; while ( ( line = reader . readLine ( ) ) != null ) { contents . append ( line ) ; contents . append ( System . getProperty ( "line.separator" ) ) ; } } catch ( FileNotFoundException e ) { } catch ( IOException e ) { e . printStackTrace ( ) ; } finally { IOUtils . closeQuietly ( reader ) ; } return contents . toString ( ) ; } } return null ; }
returns the content of a file as a string .
