Code
/**
* Java code for jar integrity testing/detection (CRC detection) <br>
* Some Common exceptions, such as CRC exceptions <br>
* Unexpected end of zlib input stream <br>
* Oversubscribed Dynamic Bit lengths tree
*
* @ Param filename
* @ Return
*/
Public static Boolean checkjarfile (File filename ){
Try {
Jarfile JF = new jarfile (filename );
For (enumeration E = JF. Entries (); E. hasmoreelements ();){
Jarentry je = (jarentry) E. nextelement ();
String outfilename = je. getname ();
If (outfilename. endswith ("/") | outfilename. endswith ("\") | outfilename. endswith (file. separator) {} else {
Inputstream in = JF. getinputstream (JE );
Byte [] buffer = new byte [2048];
While (in. Read (buffer)> 0 ){
;
}
In. Close ();
}
}
Return true;
} Catch (exception ex ){
Ex. printstacktrace ();
Return false;
}
}
Java code for jar integrity testing