private String crc(InputStream input){
  if (input == null)   throw new IllegalArgumentException("input cannot be null.");
  CRC32 crc=new CRC32();
  byte[] buffer=new byte[4096];
  try {
    while (true) {
      int length=input.read(buffer);
      if (length == -1)       break;
      crc.update(buffer,0,length);
    }
  }
 catch (  Exception ex) {
    try {
      input.close();
    }
 catch (    Exception ignored) {
    }
  }
  return Long.toString(crc.getValue());
}

private String crc ( InputStream input ) { if ( input == null ) throw new IllegalArgumentException ( "input cannot be null." ) ; CRC32 crc = new CRC32 ( ) ; byte [ ] buffer = new byte [ 4096 ] ; try { while ( true ) { int length = input . read ( buffer ) ; if ( length == - 1 ) break ; crc . update ( buffer , 0 , length ) ; } } catch ( Exception ex ) { try { input . close ( ) ; } catch ( Exception ignored ) { } } return Long . toString ( crc . getValue ( ) ) ; }
returns a crc of the remaining bytes in the stream .
