Thursday 15 September 2011

java - Is it possible to determine the CRC of a zip file ? -


I'm not sure that the concept is correct, but I know that we can verify that the integrity of the files However, my question is, if I get a zip file, then there will be a CRC for that entry and if so, how can I decide?

To calculate the CRC-32 checksum for any data stream, click java. Use.zip.CRC32 .

  BufferedInputStream bis = new BufferedInputStream (new file inputstream (new file ("/ path / to / file.zip")); Int read = 0; CRC 32 checksum = new CRC 32 (); Byte [] buffer = new byte [1024]; While ((read = bis.read (buffer))! = -1) {checksum.update (buffer, 0, reading); } Bis.close (); System.out.println ("The CRC of your zip is 32:" + checksum.getValue ());    

No comments:

Post a Comment