我目前正在開發一個工具,它允許我修改zip文件的md5。該文件的目錄結構看起來像遍歷zip文件中的所有目錄java
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();
}
對錢的權利 – cybertextron