Class S3ObjectV2

java.lang.Object
org.cdlib.mrt.s3v2.action.S3ObjectV2

public class S3ObjectV2 extends Object
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 Details

    • S3ObjectV2

      public S3ObjectV2()
  • Method Details

    • main

      public static void main(String[] args)
    • 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 service
      bucketName - the name of the S3 bucket that contains the object
      keyName - the key (name) of the S3 object