public void processStorageItem(final StorageItem item)
throws Exception
{
if (item instanceof StorageFileItem) {
final StorageFileItem file = (StorageFileItem) item;
final ChecksummingContentLocator sha1cl =
new ChecksummingContentLocator(file.getContentLocator(), MessageDigest.getInstance("SHA1"),
StorageFileItem.DIGEST_SHA1_KEY, item.getItemContext());
// md5 is deprecated but still calculated
ChecksummingContentLocator md5cl =
new ChecksummingContentLocator(sha1cl, MessageDigest.getInstance("MD5"),
StorageFileItem.DIGEST_MD5_KEY, item.getItemContext());
try (final InputStream is = md5cl.getContent()) {
StreamSupport.copy(is, nullOutputStream(), StreamSupport.BUFFER_SIZE);
}
// we made sure that above operations will make values into context
maybeGetFromContext(item);
}