@Internal public interface S3AccessHelper
Multipart uploads are convenient for large object. These will be uploaded in multiple parts and the mutli-part upload is the equivalent of a transaction, where the upload with all its parts will be either committed or discarded.
Modifier and Type | Method and Description |
---|---|
com.amazonaws.services.s3.model.CompleteMultipartUploadResult |
commitMultiPartUpload(String key,
String uploadId,
List<com.amazonaws.services.s3.model.PartETag> partETags,
long length,
AtomicInteger errorCount)
Finalizes a Multi-Part Upload.
|
boolean |
deleteObject(String key)
Deletes the object associated with the provided key.
|
long |
getObject(String key,
File targetLocation)
Gets the object associated with the provided
key from S3 and
puts it in the provided targetLocation . |
com.amazonaws.services.s3.model.ObjectMetadata |
getObjectMetadata(String key)
Fetches the metadata associated with a given key on S3.
|
com.amazonaws.services.s3.model.PutObjectResult |
putObject(String key,
File inputFile)
Uploads an object to S3.
|
String |
startMultiPartUpload(String key)
Initializes a Multi-Part Upload.
|
com.amazonaws.services.s3.model.UploadPartResult |
uploadPart(String key,
String uploadId,
int partNumber,
File inputFile,
long length)
Uploads a part and associates it with the MPU with the provided
uploadId . |
String startMultiPartUpload(String key) throws IOException
key
- the key whose value we want to upload in parts.IOException
com.amazonaws.services.s3.model.UploadPartResult uploadPart(String key, String uploadId, int partNumber, File inputFile, long length) throws IOException
uploadId
.key
- the key this MPU is associated with.uploadId
- the id of the MPU.partNumber
- the number of the part being uploaded (has to be in [1 ... 10000]).inputFile
- the (local) file holding the part to be uploaded.length
- the length of the part.result
of the attempt to upload the part.IOException
com.amazonaws.services.s3.model.PutObjectResult putObject(String key, File inputFile) throws IOException
uploadPart(String, String, int, File, long)
method,
this object is not going to be associated to any MPU and, as such, it is not subject to the garbage collection
policies specified for your S3 bucket.key
- the key used to identify this part.inputFile
- the (local) file holding the data to be uploaded.result
of the attempt to stage the incomplete part.IOException
com.amazonaws.services.s3.model.CompleteMultipartUploadResult commitMultiPartUpload(String key, String uploadId, List<com.amazonaws.services.s3.model.PartETag> partETags, long length, AtomicInteger errorCount) throws IOException
key
- the key identifying the object we finished uploading.uploadId
- the id of the MPU.partETags
- the list of ETags
associated with this MPU.length
- the size of the uploaded object.errorCount
- a counter that will be used to count any failed attempts to commit the MPU.result
of the attempt to finalize the MPU.IOException
boolean deleteObject(String key) throws IOException
key
- The key to be deleted.true
if the resources were successfully freed, false
otherwise
(e.g. the file to be deleted was not there).IOException
long getObject(String key, File targetLocation) throws IOException
key
from S3 and
puts it in the provided targetLocation
.key
- the key of the object to fetch.targetLocation
- the file to read the object to.IOException
com.amazonaws.services.s3.model.ObjectMetadata getObjectMetadata(String key) throws IOException
key
- the key.ObjectMetadata
.IOException
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.