public static String convertToString ( InputStream input ) throws IOException { try { if ( input == null ) { throw new IOException ( "Input Stream Cannot be NULL" ) ; } StringBuilder sb1 = new StringBuilder ( ) ; String line ; try { BufferedReader r1 = new BufferedReader ( new InputStreamReader ( input , "UTF-8" ) ) ; while ( ( line = r1 . readLine ( ) ) != null ) { sb1 . append ( line ) ; } } finally { input . close ( ) ; } return sb1 . toString ( ) ; } catch ( IOException e ) { throw new JKException ( e ) ; } }
Convert to string .