AWS S3 Java SDK - Download file help

前端 未结 5 1519
臣服心动
臣服心动 2020-12-13 03:59

The code below only works for downloading text files from a bucket in S3. This does not work for an image. Is there an easier way to manage downloads/types using the AWS S

5条回答
  •  醉话见心
    2020-12-13 04:40

    There is even much simpler way to get this. I used below snippet. Got reference from http://docs.ceph.com/docs/mimic/radosgw/s3/java/

    AmazonS3 s3client = AmazonS3ClientBuilder.standard()
                    .withCredentials(new AWSStaticCredentialsProvider(credentials)).withRegion(Regions.US_EAST_1).build();
    
    s3client.getObject(
                    new GetObjectRequest("nomad-prop-pics", "Documents/1.pdf"),
                    new File("D:\\Eka-Contract-Physicals-Dev\\Contracts-Physicals\\utility-service\\downlods\\1.pdf")
        );
    

提交回复
热议问题