private static String cowInputStreamToString ( final InputStream cowInputStream ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( cowInputStream ) ) ; StringBuilder sb = new StringBuilder ( ) ; String line ; try { String newLine = System . getProperty ( "line.separator" ) ; while ( ( line = reader . readLine ( ) ) != null ) { sb . append ( line ) ; sb . append ( newLine ) ; } reader . close ( ) ; } catch ( IOException ex ) { Logger . getLogger ( Cowloader . class . getName ( ) ) . log ( Level . SEVERE , null , ex ) ; } finally { if ( cowInputStream != null ) { try { cowInputStream . close ( ) ; } catch ( IOException ex ) { Logger . getLogger ( Cowloader . class . getName ( ) ) . log ( Level . SEVERE , null , ex ) ; } } } return sb . toString ( ) ; }
Reads a cowfile from an InputStream and returns a string .