我目前正在开发一个工具,让我修改压缩文件的MD5。 该文件的目录结构如下
baselines->
models -> icons ->
lang ->
(a bunch of files here)
然而,当我跑我的代码,没有这些目录的越来越迭代成。 输出给我:
Name:model/visualization_dependency.xml
Name:model/visualization_template.xml
Name:model/weldmgmt_dependency.xml
Name:model/weldmgmt_template.xml
我期待像模型/基线/ somefile.xml在输出出现,但事实并非如此。 有什么想法吗?
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();
}