请仔细阅读下面代码,其中 MDSinputStream 继承自 java.io.BufferedInputStream 类; showProcess ()是该类的私有函数,用于计算进度: MD5.asHex() 是一个公共函数,用于将 MD5 计算结果转换为可显示的字符串。
private String computeMD5(FILE file) throws IOException {
int buf_size = 65536;
byte[] buf = new byte[buf_size];
MD5InputStream close_me = null;
try{
close_me = new MD5InputStream new(File InputStream(file));
int completed = 0;while ((completed = close_me.read(buf)) != -1) {
this.showProcess(completed);
}
String result = MD5.asHex(in.hash());
close_me.close();
close_me = null;
return result;
}catch (IOException e) {
throw e;
}
} 请指出上述代码最关键的问题,并改正:
