Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   *
   * Licensed under the Apache License, Version 2.0 (the "License").
   * You may not use this file except in compliance with the License.
   * A copy of the License is located at
   *
   *  http://aws.amazon.com/apache2.0
   *
  * or in the "license" file accompanying this file. This file is distributed
  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
  * express or implied. See the License for the specific language governing
  * permissions and limitations under the License.
  */
 package com.amazonaws.services.s3.model;
 
 import java.io.File;
 
Contains the parameters used for the UploadPart operation on Amazon S3.

If you are uploading parts for KMS-encrypted objects, you need to specify the correct region of the bucket on your client and configure AWS Signature Version 4 for added security. For more information on how to do this, see http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html#specify -signature-version

Required Parameters: BucketName, Key, UploadId, PartNumber

 
 public class UploadPartRequest extends AmazonWebServiceRequest implements
         SSECustomerKeyProviderS3DataSource {
    
Additional information about the part being uploaded, such as referrer.
 
     private ObjectMetadata objectMetadata;
    
The name of the bucket containing the initiated multipart upload with which this new part will be associated.
 
     private String bucketName;

    
The key of the initiated multipart upload
 
     private String key;

    
The ID of an existing, initiated multipart upload, with which this new part will be associated.
 
     private String uploadId;

    
The part number describing this part's position relative to the other parts in the multipart upload. Part number must be between 1 and 10,000 (inclusive).
 
     private int partNumber;

    
The size of this part, in bytes.
 
     private long partSize;

    
The optional, but recommended, MD5 hash of the content of this part. If specified, this value will be sent to Amazon S3 to verify the data integrity when the data reaches Amazon S3.
 
     private String md5Digest;

    
The stream containing the data to upload for the new part. Exactly one File or InputStream must be specified as the input to this operation.
 
     private InputStream inputStream;

    
The file containing the data to upload. Exactly one File or InputStream must be specified as the input to this operation.
 
     private File file;

    
The optional offset in the specified file, at which to begin uploading data for this part. If not specified, data will be read from the beginning of the file.
 
     private long fileOffset;

    
Allows the caller to indicate if this is the last part being uploaded in a multipart upload.
 
     private boolean isLastPart;

    
The optional customer-provided server-side encryption key to use to encrypt the object part being uploaded.
    private SSECustomerKey sseCustomerKey;


    
Sets the stream containing the data to upload for the new part.

Parameters:
inputStream the stream containing the data to upload for the new part.
    @Override
    public void setInputStream(InputStream inputStream) {
        this. = inputStream;
    }

    
Returns the stream containing the data to upload for the new part.

Returns:
the stream containing the data to upload for the new part.
    @Override
    public InputStream getInputStream() {
        return ;
    }

    
Sets the stream containing the data to upload for the new part, and returns this updated object so that additional method calls can be chained together.

Parameters:
inputStream the stream containing the data to upload for the new part.
Returns:
The updated UploadPartRequest object.
    public UploadPartRequest withInputStream(InputStream inputStream) {
        setInputStream(inputStream);
        return this;
    }

    
Returns the name of the bucket containing the existing, initiated multipart upload, with which this new part will be associated.

Returns:
the name of the bucket containing the existing, initiated multipart upload, with which this new part will be associated.
    public String getBucketName() {
        return ;
    }

    
Sets the name of the bucket containing the existing, initiated multipart upload, with which this new part will be associated.

Parameters:
bucketName the name of the bucket containing the existing, initiated multipart upload, with which this new part will be associated.
    public void setBucketName(String bucketName) {
        this. = bucketName;
    }

    
Sets the name of the bucket containing the existing, initiated multipart upload, with which this new part will be associated, and returns this updated object so that additional method calls can be chained together.

Parameters:
bucketName the name of the bucket containing the existing, initiated multipart upload, with which this new part will be associated.
Returns:
This updated UploadPartRequest object.
    public UploadPartRequest withBucketName(String bucketName) {
        this. = bucketName;
        return this;
    }

    
Returns the key of the initiated multipart upload.

Returns:
the key of the initiated multipart upload.
    public String getKey() {
        return ;
    }

    
Sets the key of the initiated multipart upload.

Parameters:
key the key of the initiated multipart upload.
    public void setKey(String key) {
        this. = key;
    }

    
Sets the key of the initiated multipart upload, and returns this updated object so that additional method calls can be chained together.

Parameters:
key the key of the initiated multipart upload.
Returns:
This updated UploadPartRequest object.
    public UploadPartRequest withKey(String key) {
        this. = key;
        return this;
    }

    
Returns the ID of the existing, initiated multipart upload with which this new part will be associated.

Returns:
the ID of the existing, initiated multipart upload with which this new part will be associated.
    public String getUploadId() {
        return ;
    }

    
Sets the ID of the existing, initiated multipart upload with which this new part will be associated.

Parameters:
uploadId the ID of the existing, initiated multipart upload with which this new part will be associated.
    public void setUploadId(String uploadId) {
        this. = uploadId;
    }

    
Sets the ID of the existing, initiated multipart upload with which this new part will be associated, and returns this updated UploadPartRequest object so that additional method calls can be chained together.

Parameters:
uploadId the ID of the existing, initiated multipart upload with which this new part will be associated.
Returns:
This updated UploadPartRequest object.
    public UploadPartRequest withUploadId(String uploadId) {
        this. = uploadId;
        return this;
    }

    
Returns the part number describing this part's position relative to the other parts in the multipart upload. Part number must be between 1 and 10,000 (inclusive).

Returns:
the part number describing this part's position relative to the other parts in the multipart upload. Part number must be between 1 and 10,000 (inclusive).
    public int getPartNumber() {
        return ;
    }

    
Sets the part number describing this part's position relative to the other parts in the multipart upload. Part number must be between 1 and 10,000 (inclusive).

Parameters:
partNumber the part number describing this part's position relative to the other parts in the multipart upload. Part number must be between 1 and 10,000 (inclusive).
    public void setPartNumber(int partNumber) {
        this. = partNumber;
    }

    
Sets the part number describing this part's position relative to the other parts in the multipart upload. Part number must be between 1 and 10,000 (inclusive).

Returns this updated UploadPartRequest object so that additional method calls can be chained together.

Parameters:
partNumber the part number describing this part's position relative to the other parts in the multipart upload. Part number must be between 1 and 10,000 (inclusive).
Returns:
This updated UploadPartRequest object.
    public UploadPartRequest withPartNumber(int partNumber) {
        this. = partNumber;
        return this;
    }

    
Returns the size of this part, in bytes.

Returns:
the size of this part, in bytes.
    public long getPartSize() {
        return ;
    }

    
Sets the size of this part, in bytes.

Parameters:
partSize the size of this part, in bytes.
    public void setPartSize(long partSize) {
        this. = partSize;
    }

    
Sets the size of this part, in bytes, and returns this updated UploadPartRequest object so that additional method calls can be chained together.

Parameters:
partSize the size of this part, in bytes.
Returns:
This updated UploadPartRequest object.
    public UploadPartRequest withPartSize(long partSize) {
        this. = partSize;
        return this;
    }

    
Returns the optional, but recommended, MD5 hash of the content of this part. If specified, this value will be sent to Amazon S3 to verify the data integrity when the data reaches Amazon S3.

Returns:
The optional, but recommended, MD5 hash of the content of this part. If specified, this value will be sent to Amazon S3 to verify the data integrity when the data reaches Amazon S3.
    public String getMd5Digest() {
        return ;
    }

    
Sets the optional, but recommended, MD5 hash of the content of this part. If specified, this value will be sent to Amazon S3 to verify the data integrity when the data reaches Amazon S3.

Parameters:
md5Digest The optional, but recommended, MD5 hash of the content of this part. If specified, this value will be sent to Amazon S3 to verify the data integrity when the data reaches Amazon S3.
    public void setMd5Digest(String md5Digest) {
        this. = md5Digest;
    }

    
Sets the optional, but recommended, MD5 hash of the content of this part. If specified, this value will be sent to Amazon S3 to verify the data integrity when the data reaches Amazon S3.

Returns this updated UploadPartRequest object so that additional method calls can be chained together.

Parameters:
md5Digest The optional, but recommended, MD5 hash of the content of this part. If specified, this value will be sent to Amazon S3 to verify the data integrity when the data reaches Amazon S3.
Returns:
This updated UploadPartRequest object.
    public UploadPartRequest withMD5Digest(String md5Digest) {
        this. = md5Digest;
        return this;
    }

    
Returns the file containing the data to upload. Exactly one File or InputStream must be specified as the input to this operation.

Returns:
The file containing the data to upload. Exactly one File or InputStream must be specified as the input to this operation.
    @Override
    public File getFile() {
        return ;
    }

    
Sets the file containing the data to upload. Exactly one File or InputStream must be specified as the input to this operation.

Parameters:
file The file containing the data to upload. Exactly one File or InputStream must be specified as the input to this operation.
    @Override
    public void setFile(File file) {
        this. = file;
    }

    
Sets the file containing the data to upload, and returns this updated UploadPartRequest object so that additional method calls can be chained together.

Exactly one File or InputStream must be specified as the input to this operation.

Parameters:
file The file containing the data to upload. Exactly one File or InputStream must be specified as the input to this operation.
Returns:
This updated UploadPartRequest object.
    public UploadPartRequest withFile(File file) {
        setFile(file);
        return this;
    }

    
Returns the optional offset in the specified file, at which to begin uploading data for this part. If not specified, data will be read from the beginning of the file.

Returns:
The optional offset in the specified file, at which to begin uploading data for this part. If not specified, data will be read from the beginning of the file.
    public long getFileOffset() {
        return ;
    }

    
Sets the optional offset in the specified file, at which to begin uploading data for this part. If not specified, data will be read from the beginning of the file.

Parameters:
fileOffset The optional offset in the specified file, at which to begin uploading data for this part. If not specified, data will be read from the beginning of the file.
    public void setFileOffset(long fileOffset) {
        this. = fileOffset;
    }

    
Sets the optional offset in the specified file, at which to begin uploading data for this part, and returns this updated UploadPartRequest object so that additional method calls can be chained together.

If not specified, data will be read from the beginning of the file.

Parameters:
fileOffset The optional offset in the specified file, at which to begin uploading data for this part. If not specified, data will be read from the beginning of the file.
Returns:
This updated UploadPartRequest object.
    public UploadPartRequest withFileOffset(long fileOffset) {
        setFileOffset(fileOffset);
        return this;
    }

    
Sets the optional progress listener for receiving updates about object upload status.

Deprecated:
use com.amazonaws.AmazonWebServiceRequest.setGeneralProgressListener(com.amazonaws.event.ProgressListener) instead.
Parameters:
progressListener The legacy progress listener that is used exclusively for Amazon S3 client.
    @Deprecated
    public void setProgressListener(com.amazonaws.services.s3.model.ProgressListener progressListener) {
        setGeneralProgressListener(new LegacyS3ProgressListener(progressListener));
    }

    
Returns the optional progress listener for receiving updates about object upload status.

Deprecated:
use com.amazonaws.AmazonWebServiceRequest.getGeneralProgressListener() instead.
Returns:
the optional progress listener for receiving updates about object upload status.
    @Deprecated
        ProgressListener generalProgressListener = getGeneralProgressListener();
        if (generalProgressListener instanceof LegacyS3ProgressListener) {
            return ((LegacyS3ProgressListener)generalProgressListener).unwrap();
        } else {
             return null;
        }
    }

    
Sets the optional progress listener for receiving updates about object upload status, and returns this updated object so that additional method calls can be chained together.

Deprecated:
use com.amazonaws.AmazonWebServiceRequest.withGeneralProgressListener(com.amazonaws.event.ProgressListener) instead.
Parameters:
progressListener The legacy progress listener that is used exclusively for Amazon S3 client.
Returns:
This updated UploadPartRequest object.
    @Deprecated
        setProgressListener(progressListener);
        return this;
    }

    
Returns true if the creator of this request has indicated this part is the last part being uploaded in a multipart upload.

Returns:
True if the creator of this request has indicated this part is the last part being uploaded in a multipart upload.
    public boolean isLastPart() {
        return ;
    }

    
Marks this part as the last part being uploaded in a multipart upload.

Parameters:
isLastPart Whether or not this is the last part being uploaded in a multipart upload.
    public void setLastPart(boolean isLastPart) {
        this. = isLastPart;
    }

    
Marks this part as the last part being uploaded in a multipart upload, and returns this updated request object so that additional method calls can be chained together.

Parameters:
isLastPart Whether or not this is the last part being uploaded in a multipart upload.
Returns:
This updated request object so that additional method calls can be chained together.
    public UploadPartRequest withLastPart(boolean isLastPart) {
        setLastPart(isLastPart);
        return this;
    }
    @Override
    public SSECustomerKey getSSECustomerKey() {
        return ;
    }

    
Sets the optional customer-provided server-side encryption key to use to encrypt the object part being uploaded.

Parameters:
sseKey The optional customer-provided server-side encryption key to use to encrypt the object part being uploaded.
    public void setSSECustomerKey(SSECustomerKey sseKey) {
        this. = sseKey;
    }

    
Sets the optional customer-provided server-side encryption key to use to encrypt the object part being uploaded, 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 object part being uploaded.
Returns:
This updated request object so that additional method calls can be chained together.
        setSSECustomerKey(sseKey);
        return this;
    }
    
Returns the additional information about the part being uploaded.
    public ObjectMetadata getObjectMetadata() {
        return ;
    }

    
Sets the additional information about the part being uploaded.
    public void setObjectMetadata(ObjectMetadata objectMetadata) {
        this. = objectMetadata;
    }

    
    public UploadPartRequest withObjectMetadata(ObjectMetadata objectMetadata) {
        setObjectMetadata(objectMetadata);
        return this;
    }
New to GrepCode? Check out our FAQ X