@Override public ObjectStatus[] getObjectStatuses() { StorageObject[] objects = mChunk.getObjects(); ObjectStatus[] ret = new ObjectStatus[objects.length]; for (int i = 0; i < ret.length; ++i) { ret[i] = new ObjectStatus(objects[i].getKey(), objects[i].getMd5HashAsBase64(), objects[i].getContentLength(), objects[i].getLastModifiedDate().getTime()); } return ret; }
/** * Calculates the MD5 hash value of the given data object, and compares it * against this object's hash (as stored in the Content-MD5 header for * uploads, or the ETag header for downloads). * * @param downloadedData * @return * true if the calculated MD5 hash value of the bytes matches this object's * hash value, false otherwise. * * @throws NoSuchAlgorithmException * @throws FileNotFoundException * @throws IOException */ public boolean verifyData(byte[] downloadedData) throws NoSuchAlgorithmException, FileNotFoundException, IOException { return getMd5HashAsBase64().equals( ServiceUtils.toBase64( ServiceUtils.computeMD5Hash(downloadedData))); }
/** * Calculates the MD5 hash value of the given data object, and compares it * against this object's hash (as stored in the Content-MD5 header for * uploads, or the ETag header for downloads). * * @param downloadedDataStream * the input stream of a downloaded object. * * @return * true if the calculated MD5 hash value of the input stream matches this * object's hash value, false otherwise. * * @throws NoSuchAlgorithmException * @throws FileNotFoundException * @throws IOException */ public boolean verifyData(InputStream downloadedDataStream) throws NoSuchAlgorithmException, FileNotFoundException, IOException { return getMd5HashAsBase64().equals( ServiceUtils.toBase64( ServiceUtils.computeMD5Hash(downloadedDataStream))); }
throws NoSuchAlgorithmException, FileNotFoundException, IOException String md5HashB64 = getMd5HashAsBase64(); if (md5HashB64 == null) { throw new IllegalStateException(
throws NoSuchAlgorithmException, FileNotFoundException, IOException String md5HashB64 = getMd5HashAsBase64(); if (md5HashB64 == null) { throw new IllegalStateException(
/** * Calculates the MD5 hash value of the given data object, and compares it * against this object's hash (as stored in the Content-MD5 header for * uploads, or the ETag header for downloads). * * @param downloadedData * @return * true if the calculated MD5 hash value of the bytes matches this object's * hash value, false otherwise. * * @throws NoSuchAlgorithmException * @throws FileNotFoundException * @throws IOException */ public boolean verifyData(byte[] downloadedData) throws NoSuchAlgorithmException, FileNotFoundException, IOException { return getMd5HashAsBase64().equals( ServiceUtils.toBase64( ServiceUtils.computeMD5Hash(downloadedData))); }
/** * Calculates the MD5 hash value of the given data object, and compares it * against this object's hash (as stored in the Content-MD5 header for * uploads, or the ETag header for downloads). * * @param downloadedDataStream * the input stream of a downloaded object. * * @return * true if the calculated MD5 hash value of the input stream matches this * object's hash value, false otherwise. * * @throws NoSuchAlgorithmException * @throws FileNotFoundException * @throws IOException */ public boolean verifyData(InputStream downloadedDataStream) throws NoSuchAlgorithmException, FileNotFoundException, IOException { return getMd5HashAsBase64().equals( ServiceUtils.toBase64( ServiceUtils.computeMD5Hash(downloadedDataStream))); }
@Override public ObjectStatus[] getObjectStatuses() { StorageObject[] objects = mChunk.getObjects(); ObjectStatus[] ret = new ObjectStatus[objects.length]; for (int i = 0; i < ret.length; ++i) { ret[i] = new ObjectStatus(objects[i].getKey(), objects[i].getMd5HashAsBase64(), objects[i].getContentLength(), objects[i].getLastModifiedDate().getTime()); } return ret; }
objectHash = storageObject.getMd5HashAsBase64();
objectHash = storageObject.getMd5HashAsBase64();