}
@Override
public String putBlob(final String containerName, final Blob blob) throws IOException {
byte[] payload;
HashCode actualHashCode;
HashingInputStream input = new HashingInputStream(Hashing.md5(), blob.getPayload().openStream());
try {
payload = ByteStreams.toByteArray(input);
actualHashCode = input.hash();
HashCode expectedHashCode = blob.getPayload().getContentMetadata().getContentMD5AsHashCode();
if (expectedHashCode != null && !actualHashCode.equals(expectedHashCode)) {
throw new IOException("MD5 hash code mismatch, actual: " + actualHashCode +
" expected: " + expectedHashCode);
}
} finally {