I'm currently developing a tool that would allow me to modify the md5 of a zip file. The directory structure of the file looks like
baselines->
models -> icons ->
lang ->
(a bunch of files here)
However, when I run my code, none of those directories are getting iterating into. The output gives me:
Name:model/visualization_dependency.xml
Name:model/visualization_template.xml
Name:model/weldmgmt_dependency.xml
Name:model/weldmgmt_template.xml
I was expecting to something like model/baseline/somefile.xml appears on the output, but it does not. Any Thoughts?
byte[] digest = null;
MessageDigest md5;
try {
md5 = MessageDigest.getInstance("MD5");
ZipEntry current;
while((current = entry.getNextEntry()) != null){
//ZipEntry current = entry.getNextEntry();
System.out.println("Size:" + current.getSize());
System.out.println("Name:" + current.getName());
if(current.isDirectory()){
digest = this.encodeUTF8(current.getName());
md5.update(digest);
}
else{
int size = (int)current.getSize();
digest = new byte[size];
entry.read(digest, 0, size);
md5.update(digest);
}
}
digest = md5.digest();
entry.close();
} catch (NoSuchAlgorithmException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}