Package org.cdlib.mrt.s3v2.action
Class S3ObjectV2
java.lang.Object
org.cdlib.mrt.s3v2.action.S3ObjectV2
Before running this Java V2 code example, set up your development
environment, including your credentials.
For more information, see the following documentation topic:
https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/get-started.html
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidgetHeadResponse(software.amazon.awssdk.services.s3.S3Client s3, String bucketName, String keyName) Lists the tags associated with an Amazon S3 object.static voidgetObjectBytes(software.amazon.awssdk.services.s3.S3Client s3, String bucketName, String keyName, String filePath) Retrieves the bytes of an object stored in an Amazon S3 bucket and saves them to a local file.static void
-
Constructor Details
-
S3ObjectV2
public S3ObjectV2()
-
-
Method Details
-
main
-
getObjectBytes
public static void getObjectBytes(software.amazon.awssdk.services.s3.S3Client s3, String bucketName, String keyName, String filePath) Retrieves the bytes of an object stored in an Amazon S3 bucket and saves them to a local file.- Parameters:
s3- The S3Client instance used to interact with the Amazon S3 service.bucketName- The name of the S3 bucket where the object is stored.keyName- The key (or name) of the S3 object.path- The local file path where the object's bytes will be saved.- Throws:
IOException- If an I/O error occurs while writing the bytes to the local file.software.amazon.awssdk.services.s3.model.S3Exception- If an error occurs while retrieving the object from the S3 bucket.
-
getHeadResponse
public static void getHeadResponse(software.amazon.awssdk.services.s3.S3Client s3, String bucketName, String keyName) Lists the tags associated with an Amazon S3 object.- Parameters:
s3- the S3Client object used to interact with the Amazon S3 servicebucketName- the name of the S3 bucket that contains the objectkeyName- the key (name) of the S3 object
-