Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FileUtils.getFileMD5 oom

See original GitHub issue

FileUtils.getFileMD5 处理大文件,报内存溢出。 建议EncryptUtils.encryptMD5File中使用: public static byte[] encryptMD5File(File file) { if (file == null) return null; FileInputStream fis = null; DigestInputStream digestInputStream = null; try { MessageDigest md = MessageDigest.getInstance("MD5"); fis = new FileInputStream(file); digestInputStream = new DigestInputStream(fis, md); byte[] buffer = new byte[256 * 1024]; while ( > 0) ; // 获取最终的MessageDigest md = digestInputStream.getMessageDigest(); return md.digest(); } catch (NoSuchAlgorithmException | IOException e) { e.printStackTrace(); return null; } finally { CloseUtils.closeIO(fis); } }

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

Blankjcommented, Nov 1, 2016

我几百兆,几个G的都测了,就这个digestInputStream 最快,已更新

Blankjcommented, Nov 1, 2016


Read more comments on GitHub >

github_iconTop Results From Across the Web

FileUtils (Apache Commons IO 2.5 API)
General file manipulation utilities. Facilities are provided in the following areas: writing to a file; reading from a file ...
Read more >
Getting a File's MD5 Checksum in Java - Stack Overflow
I am looking to use Java to get the MD5 checksum of a file. I was really surprised but I haven't been able...
Read more >
Index (StarTeam SDK Documentation) - ADM Help Centers
FileUtils. compare two files ... FileUtils - Class in com.starteam.util ... getFileMD5() - Method in interface com.starteam.File.Digest.
Read more >
Viewing online file analysis results for 'com.light.browser.apk'
Resp getFileMd5 = Ansi based on Hybrid Analysis (LandDownloadAppTask.smali). response_failed_. Ansi based on Hybrid Analysis (LandReceiver.smali).
Read more >
Automated Malware Analysis Report for app.apk - Joe Sandbox
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found