code: public static boolean compareStreams( InputStream in1, InputStream in2 )
          throws IOException
      {
          boolean moreOnIn1;
          do
          {
              int v1 = in1.read();
              int v2 = in2.read();
              if( v1 != v2 )
              {
                  return false;
              }
              moreOnIn1 = v1 != -1;
          }
          while( moreOnIn1 );
          boolean noMoreOnIn2Either = in2.read() == -1;
          return noMoreOnIn2Either;
      }
docs: Compares if two streams are identical in their contents.
  
  @param in1 The first stream.
  @param in2 The second stream.
  
  @return true if both streams contains the same byte data, including having the same number of characters in them.
  
  @throws IOException If an underlying I/O problem occured.