1

My service occasionally fetches some content (mostly image files) in batches (20 at a time), in a concurrent manner. Sometimes, some of these image files end up corrupted (browser doesn't render them), not sure why, but it only happens when downloading in larger batches. How to check programmatically if the download was corrupted so I can restart it?

I use Play2 WS on Scala. Iteratees not used.

Dominykas Mostauskis
  • 7,797
  • 3
  • 48
  • 67

1 Answers1

0

stackoverflow.com/questions/304268/getting-a-files-md5-checksum-in-java

try retrieving the md5 checksum. would that work for you?

Use DigestUtils from Apache Commons Codec library:

FileInputStream fis = new FileInputStream(new File("foo"));
String md5 = org.apache.commons.codec.digest.DigestUtils.md5Hex(fis);
Community
  • 1
  • 1
Stefan Kunze
  • 741
  • 6
  • 15