public static String readText ( InputStream inputStream ) { BufferedReader bufferedReader = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; String line ; StringBuilder stringBuilder = new StringBuilder ( ) ; try { while ( ( line = bufferedReader . readLine ( ) ) != null ) { stringBuilder . append ( line ) ; stringBuilder . append ( ' ' ) ; } } catch ( IOException e ) { Logger . error ( e . getMessage ( ) ) ; e . printStackTrace ( ) ; return null ; } finally { if ( bufferedReader != null ) { try { bufferedReader . close ( ) ; } catch ( IOException e ) { Logger . error ( e . getMessage ( ) ) ; e . printStackTrace ( ) ; } } } return stringBuilder . toString ( ) ; }
Read text .