question: public static boolean streamContentEquals ( InputStream s1 , InputStream s2 ) throws IOException { try { int b1 , b2 ; do { b1 = s1 . read ( ) ; b2 = s2 . read ( ) ; } while ( ( b1 == b2 ) && ( b1 != - 1 ) ) ; return b1 == b2 ; } finally { try { s1 . close ( ) ; s2 . close ( ) ; } catch ( Exception e ) { } } }
target:  Checks if both InputStreams have the same content and length. The streams are closed after reading.