【发布时间】:2012-06-14 18:42:27
【问题描述】:
我正在尝试从我在 stackoverflow 中遇到的上一个问题中实现此算法描述:
suppressing or not allowing the access time to be modified java
所以我实现为
byte[] digest = new byte[this.BUFFER];
MessageDigest md5;
try {
md5 = MessageDigest.getInstance("MD5");
while(entry.getNextEntry() != null){
ZipEntry current = entry.getNextEntry();
if(current.isDirectory()){
digest = this.encodeUTF8(current.getName());
md5.update(digest);
}
else{
entry.read(digest, 0, this.BUFFER);
md5.update(digest);
}
}
digest = md5.digest();
entry.close();
} catch (NoSuchAlgorithmException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
但是,我在 else 语句中的线程“main”java.lang.IndexOutOfBoundsException 中遇到异常。有人知道为什么吗?另外,请问我的算法是否正确实现?
【问题讨论】:
标签: java exception zip nullpointerexception indexoutofboundsexception