3条建议:
while (fc.read(bbf) != -1) { md.update(bbf.array(), 0, bytes); bbf.clear();}
2)不要同时关闭fc和fis,这是多余的,关闭fis就足够了。FileInputStream.close API说:
If this stream has an associated channel then the channel is closed as well.
3)如果您想通过使用FileChannel来提高性能
ByteBuffer.allocateDirect(1024);
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)