Reputation: 402
I want to access the files in a particular s3 bucket folder (There's a folder structure).
I want to get that file as an File object in java. I have the bucket name, region name and the access id is with me.
Please let me know how to do this or a link that I can refer to.
Thanks in advance
Upvotes: 2
Views: 3638
Reputation: 215
The implementation to be used may be the same as the AWS documentation, however when it is necessary to read a file inside a folder, you need to specify which folder is the file.
For example, we want to get a file named listOfCountries.json inside the world folder, when you pass the key to access the S3 report folder.
System.out.println("Downloading an object");
fullObject = s3Client.getObject(new GetObjectRequest("bucketName", "world/listOfCountries.json"));
Upvotes: 1
Reputation: 201048
You can't get that as a File
object in Java since it isn't a local file. You have to download it first if you want to use the File
class. Otherwise look at the methods available in the AWS SDK for Java.
Upvotes: 0