Class AbstractPutObjectRequest

    • Constructor Detail

      • AbstractPutObjectRequest

        public AbstractPutObjectRequest​(String bucketName,
                                        String key,
                                        File file)
        Constructs a new AbstractPutObjectRequest object to upload a file to the specified bucket and key. After constructing the request, users may optionally specify object metadata or a canned ACL as well.
        Parameters:
        bucketName - The name of an existing bucket to which the new object will be uploaded.
        key - The key under which to store the new object.
        file - The path of the file to upload to Amazon S3.
      • AbstractPutObjectRequest

        public AbstractPutObjectRequest​(String bucketName,
                                        String key,
                                        String redirectLocation)
        Constructs a new AbstractPutObjectRequest object with redirect location. After constructing the request, users may optionally specify object metadata or a canned ACL as well.
        Parameters:
        bucketName - The name of an existing bucket to which the new object will be uploaded.
        key - The key under which to store the new object.
        redirectLocation - The redirect location of this new object.
      • AbstractPutObjectRequest

        protected AbstractPutObjectRequest​(String bucketName,
                                           String key,
                                           InputStream input,
                                           ObjectMetadata metadata)
        Constructs a new AbstractPutObjectRequest object to upload a stream of data to the specified bucket and key. After constructing the request, users may optionally specify object metadata or a canned ACL as well.

        Content length for the data stream must be specified in the object metadata parameter; Amazon S3 requires it be passed in before the data is uploaded. Failure to specify a content length will cause the entire contents of the input stream to be buffered locally in memory so that the content length can be calculated, which can result in negative performance problems.

        Parameters:
        bucketName - The name of an existing bucket to which the new object will be uploaded.
        key - The key under which to store the new object.
        input - The stream of data to upload to Amazon S3.
        metadata - The object metadata. At minimum this specifies the content length for the stream of data being uploaded.
    • Method Detail

      • getBucketName

        public String getBucketName()
        Gets the name of the existing bucket where this request will upload a new object to. In order to upload the object, users must have Permission.Write permission granted.
        Returns:
        The name of an existing bucket where this request will upload a new object to.
        See Also:
        setBucketName(String), withBucketName(String)
      • setBucketName

        public void setBucketName​(String bucketName)
        Sets the name of an existing bucket where this request will upload a new object to. In order to upload the object, users must have Permission.Write permission granted.
        Parameters:
        bucketName - The name of an existing bucket where this request will upload a new object to. In order to upload the object, users must have Permission.Write permission granted.
        See Also:
        getBucketName(), withBucketName(String)
      • withBucketName

        public <T extends AbstractPutObjectRequest> T withBucketName​(String bucketName)
        Sets the name of the bucket where this request will upload a new object to. Returns this object, enabling additional method calls to be chained together.

        In order to upload the object, users must have Permission.Write permission granted.

        Parameters:
        bucketName - The name of an existing bucket where this request will upload a new object to. In order to upload the object, users must have Permission.Write permission granted.
        Returns:
        This AbstractPutObjectRequest, enabling additional method calls to be chained together.
        See Also:
        getBucketName(), setBucketName(String)
      • getKey

        public String getKey()
        Gets the key under which to store the new object.
        Returns:
        The key under which to store the new object.
        See Also:
        setKey(String), withKey(String)
      • setKey

        public void setKey​(String key)
        Sets the key under which to store the new object.
        Parameters:
        key - The key under which to store the new object.
        See Also:
        getKey(), withKey(String)
      • withKey

        public <T extends AbstractPutObjectRequest> T withKey​(String key)
        Sets the key under which to store the new object. Returns this object, enabling additional method calls to be chained together.
        Parameters:
        key - The key under which to store the new object.
        Returns:
        This AbstractPutObjectRequest, enabling additional method calls to be chained together.
        See Also:
        getKey(), setKey(String)
      • setStorageClass

        public void setStorageClass​(StorageClass storageClass)
        Sets the optional Amazon S3 storage class to use when storing the new object. If not specified, the default standard storage class will be used when storing the object.

        For more information on Amazon S3 storage classes and available values, see the StorageClass enumeration.

        Parameters:
        storageClass - The storage class to use when storing the new object.
        See Also:
        getStorageClass(), setStorageClass(String)
      • setFile

        public void setFile​(File file)
        Sets the path and name of the file containing the data to be uploaded to Amazon S3. Either specify a file or an input stream containing the data to be uploaded to Amazon S3; both cannot be specified.
        Specified by:
        setFile in interface S3DataSource
        Parameters:
        file - The path and name of the file containing the data to be uploaded to Amazon S3.
        See Also:
        getFile(), withFile(File), getInputStream(), withInputStream(InputStream)
      • getMetadata

        public ObjectMetadata getMetadata()
        Gets the optional metadata instructing Amazon S3 how to handle the uploaded data (e.g. custom user metadata, hooks for specifying content type, etc.).

        If uploading from an input stream, always specify metadata with the content size set. Otherwise the contents of the input stream have to be buffered in memory before being sent to Amazon S3. This can cause very negative performance impacts.

        Returns:
        The optional metadata instructing Amazon S3 how to handle the uploaded data (e.g. custom user metadata, hooks for specifying content type, etc.).
        See Also:
        setMetadata(ObjectMetadata), withMetadata(ObjectMetadata)
      • setMetadata

        public void setMetadata​(ObjectMetadata metadata)
        Sets the optional metadata instructing Amazon S3 how to handle the uploaded data (e.g. custom user metadata, hooks for specifying content type, etc.).

        If uploading from an input stream, always specify metadata with the content size set. Otherwise the contents of the input stream have to be buffered in memory before being sent to Amazon S3. This can cause very negative performance impacts.

        Parameters:
        metadata - The optional metadata instructing Amazon S3 how to handle the uploaded data (e.g. custom user metadata, hooks for specifying content type, etc.).
        See Also:
        getMetadata(), withMetadata(ObjectMetadata)
      • withMetadata

        public <T extends AbstractPutObjectRequest> T withMetadata​(ObjectMetadata metadata)
        Sets the optional metadata instructing Amazon S3 how to handle the uploaded data (e.g. custom user metadata, hooks for specifying content type, etc.). Returns this AbstractPutObjectRequest, enabling additional method calls to be chained together.

        If uploading from an input stream, always specify metadata with the content size set. Otherwise the contents of the input stream have to be buffered in memory before being sent to Amazon S3. This can cause very negative performance impacts.

        Parameters:
        metadata - The optional metadata instructing Amazon S3 how to handle the uploaded data (e.g. custom user metadata, hooks for specifying content type, etc.).
        Returns:
        This AbstractPutObjectRequest, enabling additional method calls to be chained together.
        See Also:
        getMetadata(), setMetadata(ObjectMetadata)
      • getAccessControlList

        public AccessControlList getAccessControlList()
        Returns the optional access control list for the new object. If specified, cannedAcl will be ignored.
      • setAccessControlList

        public void setAccessControlList​(AccessControlList accessControlList)
        Sets the optional access control list for the new object. If specified, cannedAcl will be ignored.
        Parameters:
        accessControlList - The access control list for the new object.
      • withAccessControlList

        public <T extends AbstractPutObjectRequest> T withAccessControlList​(AccessControlList accessControlList)
        Sets the optional access control list for the new object. If specified, cannedAcl will be ignored. Returns this AbstractPutObjectRequest, enabling additional method calls to be chained together.
        Parameters:
        accessControlList - The access control list for the new object.
      • getInputStream

        public InputStream getInputStream()
        Gets the input stream containing the data to be uploaded to Amazon S3. The user of this request must either specify a file or an input stream containing the data to be uploaded to Amazon S3; both cannot be specified.
        Specified by:
        getInputStream in interface S3DataSource
        Returns:
        The input stream containing the data to be uploaded to Amazon S3. Either specify a file or an input stream containing the data to be uploaded to Amazon S3, not both.
        See Also:
        setInputStream(InputStream), withInputStream(InputStream), setFile(File), withFile(File)
      • setInputStream

        public void setInputStream​(InputStream inputStream)
        Sets the input stream containing the data to be uploaded to Amazon S3. Either specify a file or an input stream containing the data to be uploaded to Amazon S3; both cannot be specified.
        Specified by:
        setInputStream in interface S3DataSource
        Parameters:
        inputStream - The input stream containing the data to be uploaded to Amazon S3. Either specify a file or an input stream containing the data to be uploaded to Amazon S3, not both.
        See Also:
        getInputStream(), withInputStream(InputStream), getFile(), withFile(File)
      • withInputStream

        public <T extends AbstractPutObjectRequest> T withInputStream​(InputStream inputStream)
        Sets the input stream containing the data to be uploaded to Amazon S3. Returns this AbstractPutObjectRequest, enabling additional method calls to be chained together.

        Either specify a file or an input stream containing the data to be uploaded to Amazon S3; both cannot be specified.

        Parameters:
        inputStream - The InputStream containing the data to be uploaded to Amazon S3.
        Returns:
        This PutObjectRequest, so that additional method calls can be chained together.
        See Also:
        getInputStream(), setInputStream(InputStream), getFile(), setFile(File)
      • setRedirectLocation

        public void setRedirectLocation​(String redirectLocation)
        Sets the optional redirect location for the new object.
        Parameters:
        redirectLocation - The redirect location for the new object.
      • getRedirectLocation

        public String getRedirectLocation()
        Gets the optional redirect location for the new object.
      • withRedirectLocation

        public <T extends AbstractPutObjectRequest> T withRedirectLocation​(String redirectLocation)
        Sets the optional redirect location for the new object.Returns this AbstractPutObjectRequest, enabling additional method calls to be chained together.
        Parameters:
        redirectLocation - The redirect location for the new object.
      • getSSECustomerKey

        public SSECustomerKey getSSECustomerKey()
        Description copied from interface: SSECustomerKeyProvider
        Returns the optional customer-provided server-side encryption key to use to encrypt the uploaded object.
        Specified by:
        getSSECustomerKey in interface SSECustomerKeyProvider
        Returns:
        The optional customer-provided server-side encryption key to use to encrypt the uploaded object.
      • setSSECustomerKey

        public void setSSECustomerKey​(SSECustomerKey sseKey)
        Sets the optional customer-provided server-side encryption key to use to encrypt the uploaded object.
        Parameters:
        sseKey - The optional customer-provided server-side encryption key to use to encrypt the uploaded object.
      • withSSECustomerKey

        public <T extends AbstractPutObjectRequest> T withSSECustomerKey​(SSECustomerKey sseKey)
        Sets the optional customer-provided server-side encryption key to use to encrypt the uploaded object, and returns the updated request object so that additional method calls can be chained together.
        Parameters:
        sseKey - The optional customer-provided server-side encryption key to use to encrypt the uploaded object.
        Returns:
        This updated request object so that additional method calls can be chained together.
      • setSSEAwsKeyManagementParams

        public void setSSEAwsKeyManagementParams​(SSEAwsKeyManagementParams params)
        Sets the AWS Key Management System parameters used to encrypt the object on server side.
      • withSSEAwsKeyManagementParams

        public <T extends AbstractPutObjectRequest> T withSSEAwsKeyManagementParams​(SSEAwsKeyManagementParams sseAwsKeyManagementParams)
        Sets the AWS Key Management System parameters used to encrypt the object on server side.
        Returns:
        returns the update PutObjectRequest