private String readFile ( File file ) { BufferedReader reader = null ; try { reader = new BufferedReader ( new FileReader ( file ) ) ; String line = null ; StringBuilder sb = new StringBuilder ( ) ; String separator = System . getProperty ( "line.separator" ) ; while ( ( line = reader . readLine ( ) ) != null ) { sb . append ( line ) . append ( separator ) ; } return sb . toString ( ) ; } catch ( FileNotFoundException e ) { throw new RuntimeException ( "We already made sure the extra args file exists" , e ) ; } catch ( IOException e ) { throw new RuntimeException ( "Error while reading from extra args file" , e ) ; } finally { if ( reader != null ) { try { reader . close ( ) ; } catch ( IOException e ) { SelendroidLogger . error ( "Failed to close reader for args file" , e ) ; } } } }
There s no nio on Android and it s not worth importing Apache commons