Use the AWS SDK for Java:
http://aws.amazon.com/sdkforjava/
And Apache Commons IO:
http://commons.apache.org/io/
Then it looks like this:
AmazonS3 s3 = new AmazonS3Client(credentials);
Not sure what you mean by βdeleteβ, but IOUtils will close the input stream of the object when it converts it to an array of bytes. If you want to remove an object from s3, this is simple:
s3.deleteObject("bucket", "key");
Zach musgrave
source share