I am creating a Java application as an exercise. For now, I want to create an application that will take the contents in a folder and copy it into my Amazon S3 bucket. Having been there, I found out that the best way to find out if 2 files are identical is to take the MD5 value.
How to iteratively take the MD5 of each file in my bucket?
According to this link:
http://docs.amazonwebservices.com/AmazonS3/latest/dev/index.html?ListingObjectKeysUsingJava.html
The ObjectListing class can display the keys of objects and (metadata?) Of your files in a bucket. But in fact, it does not indicate how I can interact with files. For example, for my local files, I use guava and do something like this:
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] md4 = Files.getDigest(localFile, md);
Looking at the AWS S3 API, you can use S3Object.getObjectContent (), which will return an InputStream. Is this the best way to work with objects directly on S3?
Finally, what is the best way to sync my local folder with a bucket in S3? Any advice is appreciated.
Thank!!!!
source
share