public abstract class AbstractPutObjectRequest extends CosServiceRequest implements Cloneable, SSECustomerKeyProvider, SSECOSKeyManagementParamsProvider, CosDataSource, Serializable
CosDataSource.Utils
Modifier | Constructor and Description |
---|---|
|
AbstractPutObjectRequest(String bucketName,
String key,
File file)
Constructs a new
AbstractPutObjectRequest object to upload a file to the specified
bucket and key. |
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. |
|
AbstractPutObjectRequest(String bucketName,
String key,
String redirectLocation)
Constructs a new
AbstractPutObjectRequest object with redirect location. |
Modifier and Type | Method and Description |
---|---|
AbstractPutObjectRequest |
clone()
Creates a shallow clone of this object for all fields except the handler context.
|
protected <T extends AbstractPutObjectRequest> |
copyPutObjectBaseTo(T target) |
AccessControlList |
getAccessControlList()
Returns the optional access control list for the new object.
|
String |
getBucketName()
Gets the name of the existing bucket where this request will upload a new object to.
|
CannedAccessControlList |
getCannedAcl()
Gets the optional pre-configured access control policy to use for the new object.
|
File |
getFile()
Gets the path and name of the file containing the data to be uploaded to Qcloud COS.
|
InputStream |
getInputStream()
Gets the input stream containing the data to be uploaded to Qcloud COS.
|
String |
getKey()
Gets the key under which to store the new object.
|
ObjectMetadata |
getMetadata()
Gets the optional metadata instructing Qcloud COS how to handle the uploaded data (e.g.
|
PicOperations |
getPicOperations() |
String |
getRedirectLocation()
Gets the optional redirect location for the new object.
|
SSECOSKeyManagementParams |
getSSECOSKeyManagementParams()
Returns the COS Key Management System parameters used to encrypt the object on server side.
|
SSECustomerKey |
getSSECustomerKey()
Returns the optional customer-provided server-side encryption key to use
to encrypt the uploaded object.
|
String |
getStorageClass()
Gets the optional Qcloud COS storage class to use when storing the new object.
|
int |
getTrafficLimit() |
void |
setAccessControlList(AccessControlList accessControlList)
Sets the optional access control list for the new object.
|
void |
setBucketName(String bucketName)
Sets the name of an existing bucket where this request will upload a new object to.
|
void |
setCannedAcl(CannedAccessControlList cannedAcl)
Sets the optional pre-configured access control policy to use for the new object.
|
void |
setFile(File file)
Sets the path and name of the file containing the data to be uploaded to Qcloud COS.
|
void |
setInputStream(InputStream inputStream)
Sets the input stream containing the data to be uploaded to Qcloud COS.
|
void |
setKey(String key)
Sets the key under which to store the new object.
|
void |
setMetadata(ObjectMetadata metadata)
Sets the optional metadata instructing Qcloud COS how to handle the uploaded data (e.g.
|
void |
setPicOperations(PicOperations picOperations) |
void |
setRedirectLocation(String redirectLocation)
Sets the optional redirect location for the new object.
|
void |
setSSECOSKeyManagementParams(SSECOSKeyManagementParams params)
Sets the COS Key Management System parameters used to encrypt the object on server side.
|
void |
setSSECustomerKey(SSECustomerKey sseKey)
Sets the optional customer-provided server-side encryption key to use to encrypt the uploaded
object.
|
void |
setStorageClass(StorageClass storageClass)
Sets the optional Qcloud COS storage class to use when storing the new object.
|
void |
setStorageClass(String storageClass)
Sets the optional Qcloud COS storage class to use when storing the new object.
|
void |
setTrafficLimit(int trafficLimit) |
<T extends AbstractPutObjectRequest> |
withAccessControlList(AccessControlList accessControlList)
Sets the optional access control list for the new object.
|
<T extends AbstractPutObjectRequest> |
withBucketName(String bucketName)
Sets the name of the bucket where this request will upload a new object to.
|
<T extends AbstractPutObjectRequest> |
withCannedAcl(CannedAccessControlList cannedAcl)
Sets the optional pre-configured access control policy to use for the new object.
|
<T extends AbstractPutObjectRequest> |
withFile(File file)
Sets the file containing the data to be uploaded to Qcloud COS.
|
<T extends AbstractPutObjectRequest> |
withInputStream(InputStream inputStream)
Sets the input stream containing the data to be uploaded to Qcloud COS.
|
<T extends AbstractPutObjectRequest> |
withKey(String key)
Sets the key under which to store the new object.
|
<T extends AbstractPutObjectRequest> |
withMetadata(ObjectMetadata metadata)
Sets the optional metadata instructing Qcloud COS how to handle the uploaded data (e.g.
|
<T extends AbstractPutObjectRequest> |
withRedirectLocation(String redirectLocation)
Sets the optional redirect location for the new object.Returns this
AbstractPutObjectRequest , enabling additional method calls to be chained together. |
<T extends AbstractPutObjectRequest> |
withSSECOSKeyManagementParams(SSECOSKeyManagementParams sseCOSKeyManagementParams)
Sets the COS Key Management System parameters used to encrypt the object on server side.
|
<T extends AbstractPutObjectRequest> |
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.
|
<T extends AbstractPutObjectRequest> |
withStorageClass(StorageClass storageClass)
Sets the optional Qcloud COS storage class to use when storing the new object.
|
<T extends AbstractPutObjectRequest> |
withStorageClass(String storageClass)
Sets the optional Qcloud COS storage class to use when storing the new object.
|
copyBaseTo, getCiSpecialEndParameter, getCloneRoot, getCloneSource, getCosCredentials, getCustomQueryParameters, getCustomRequestHeaders, getFixedEndpointAddr, getGeneralProgressListener, getReadLimit, getRequestClientOptions, putCustomQueryParameter, putCustomRequestHeader, setCiSpecialEndParameter, setCosCredentials, setFixedEndpointAddr, setGeneralProgressListener, withGeneralProgressListener
public AbstractPutObjectRequest(String bucketName, String key, File file)
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.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 Qcloud COS.public AbstractPutObjectRequest(String bucketName, String key, String redirectLocation)
AbstractPutObjectRequest
object with redirect location. After
constructing the request, users may optionally specify object metadata or a canned ACL as
well.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.protected AbstractPutObjectRequest(String bucketName, String key, InputStream input, ObjectMetadata metadata)
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; Qcloud COS 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.
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 Qcloud COS.metadata
- The object metadata. At minimum this specifies the content length for the
stream of data being uploaded.public String getBucketName()
Permission.Write
permission granted.setBucketName(String)
,
withBucketName(String)
public void setBucketName(String bucketName)
Permission.Write
permission granted.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.getBucketName()
,
withBucketName(String)
public <T extends AbstractPutObjectRequest> T withBucketName(String bucketName)
In order to upload the object, users must have Permission.Write
permission granted.
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.AbstractPutObjectRequest
, enabling additional method calls to be chained
together.getBucketName()
,
setBucketName(String)
public String getKey()
setKey(String)
,
withKey(String)
public void setKey(String key)
key
- The key under which to store the new object.getKey()
,
withKey(String)
public <T extends AbstractPutObjectRequest> T withKey(String key)
key
- The key under which to store the new object.AbstractPutObjectRequest
, enabling additional method calls to be chained
together.getKey()
,
setKey(String)
public String getStorageClass()
For more information on available Qcloud COS storage classes, see the StorageClass
enumeration.
setStorageClass(String)
,
setStorageClass(StorageClass)
,
withStorageClass(StorageClass)
,
withStorageClass(String)
public void setStorageClass(String storageClass)
For more information on Qcloud COS storage classes and available values, see the
StorageClass
enumeration.
storageClass
- The storage class to use when storing the new object.getStorageClass()
,
setStorageClass(String)
,
withStorageClass(StorageClass)
,
withStorageClass(String)
public <T extends AbstractPutObjectRequest> T withStorageClass(String storageClass)
AbstractPutObjectRequest
, enabling additional method calls to be chained together. If
not specified, the default standard storage class will be used when storing the object.
For more information on Qcloud COS storage classes and available values, see the
StorageClass
enumeration.
storageClass
- The storage class to use when storing the new object.AbstractPutObjectRequest
, enabling additional method calls to be chained
together.getStorageClass()
,
setStorageClass(StorageClass)
,
setStorageClass(String)
,
withStorageClass(StorageClass)
public void setStorageClass(StorageClass storageClass)
For more information on Qcloud COS storage classes and available values, see the
StorageClass
enumeration.
storageClass
- The storage class to use when storing the new object.getStorageClass()
,
setStorageClass(String)
public <T extends AbstractPutObjectRequest> T withStorageClass(StorageClass storageClass)
AbstractPutObjectRequest
, enabling additional method calls to be chained together. If
not specified, the default standard storage class will be used when storing the object.
For more information on Qcloud COS storage classes and available values, see the
StorageClass
enumeration.
storageClass
- The storage class to use when storing the new object.AbstractPutObjectRequest
, enabling additional method calls to be chained
together.getStorageClass()
,
setStorageClass(StorageClass)
,
setStorageClass(String)
,
withStorageClass(String)
public File getFile()
getFile
in interface CosDataSource
setFile(File)
,
withFile(File)
,
setInputStream(InputStream)
,
withInputStream(InputStream)
public void setFile(File file)
setFile
in interface CosDataSource
file
- The path and name of the file containing the data to be uploaded to Qcloud COS.getFile()
,
withFile(File)
,
getInputStream()
,
withInputStream(InputStream)
public <T extends AbstractPutObjectRequest> T withFile(File file)
AbstractPutObjectRequest
, enabling additional method calls to be chained together.
Either specify a file or an input stream containing the data to be uploaded to Qcloud COS; both cannot be specified.
file
- The file containing the data to be uploaded to Qcloud COS.AbstractPutObjectRequest
, enabling additional method calls to be chained
together.getFile()
,
setFile(File)
,
getInputStream()
,
setInputStream(InputStream)
public ObjectMetadata getMetadata()
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 Qcloud COS. This can cause very negative performance impacts.
setMetadata(ObjectMetadata)
,
withMetadata(ObjectMetadata)
public void setMetadata(ObjectMetadata metadata)
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 Qcloud COS. This can cause very negative performance impacts.
metadata
- The optional metadata instructing Qcloud COS how to handle the uploaded data
(e.g. custom user metadata, hooks for specifying content type, etc.).getMetadata()
,
withMetadata(ObjectMetadata)
public <T extends AbstractPutObjectRequest> T withMetadata(ObjectMetadata metadata)
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 Qcloud COS. This can cause very negative performance impacts.
metadata
- The optional metadata instructing Qcloud COS how to handle the uploaded data
(e.g. custom user metadata, hooks for specifying content type, etc.).AbstractPutObjectRequest
, enabling additional method calls to be chained
together.getMetadata()
,
setMetadata(ObjectMetadata)
public CannedAccessControlList getCannedAcl()
setCannedAcl(CannedAccessControlList)
,
withCannedAcl(CannedAccessControlList)
public void setCannedAcl(CannedAccessControlList cannedAcl)
cannedAcl
- The optional pre-configured access control policy to use for the new object.getCannedAcl()
,
withCannedAcl(CannedAccessControlList)
public <T extends AbstractPutObjectRequest> T withCannedAcl(CannedAccessControlList cannedAcl)
AbstractPutObjectRequest
, enabling additional method calls to be chained
together.cannedAcl
- The optional pre-configured access control policy to use for the new object.AbstractPutObjectRequest
, enabling additional method calls to be chained
together.getCannedAcl()
,
setCannedAcl(CannedAccessControlList)
public AccessControlList getAccessControlList()
public void setAccessControlList(AccessControlList accessControlList)
accessControlList
- The access control list for the new object.public <T extends AbstractPutObjectRequest> T withAccessControlList(AccessControlList accessControlList)
AbstractPutObjectRequest
, enabling additional method calls to
be chained together.accessControlList
- The access control list for the new object.public InputStream getInputStream()
getInputStream
in interface CosDataSource
setInputStream(InputStream)
,
withInputStream(InputStream)
,
setFile(File)
,
withFile(File)
public void setInputStream(InputStream inputStream)
setInputStream
in interface CosDataSource
inputStream
- The input stream containing the data to be uploaded to Qcloud COS. Either
specify a file or an input stream containing the data to be uploaded to Qcloud COS,
not both.getInputStream()
,
withInputStream(InputStream)
,
getFile()
,
withFile(File)
public <T extends AbstractPutObjectRequest> T withInputStream(InputStream inputStream)
AbstractPutObjectRequest
, enabling additional method calls to be chained together.
Either specify a file or an input stream containing the data to be uploaded to Qcloud COS; both cannot be specified.
inputStream
- The InputStream containing the data to be uploaded to Qcloud COS.getInputStream()
,
setInputStream(InputStream)
,
getFile()
,
setFile(File)
public void setRedirectLocation(String redirectLocation)
redirectLocation
- The redirect location for the new object.public String getRedirectLocation()
public <T extends AbstractPutObjectRequest> T withRedirectLocation(String redirectLocation)
AbstractPutObjectRequest
, enabling additional method calls to be chained together.redirectLocation
- The redirect location for the new object.public SSECustomerKey getSSECustomerKey()
SSECustomerKeyProvider
getSSECustomerKey
in interface SSECustomerKeyProvider
public void setSSECustomerKey(SSECustomerKey sseKey)
sseKey
- The optional customer-provided server-side encryption key to use to encrypt the
uploaded object.public <T extends AbstractPutObjectRequest> T withSSECustomerKey(SSECustomerKey sseKey)
sseKey
- The optional customer-provided server-side encryption key to use to encrypt the
uploaded object.public SSECOSKeyManagementParams getSSECOSKeyManagementParams()
getSSECOSKeyManagementParams
in interface SSECOSKeyManagementParamsProvider
public void setSSECOSKeyManagementParams(SSECOSKeyManagementParams params)
public <T extends AbstractPutObjectRequest> T withSSECOSKeyManagementParams(SSECOSKeyManagementParams sseCOSKeyManagementParams)
public AbstractPutObjectRequest clone()
CosServiceRequest
clone
in class CosServiceRequest
Object.clone()
protected final <T extends AbstractPutObjectRequest> T copyPutObjectBaseTo(T target)
public int getTrafficLimit()
public void setTrafficLimit(int trafficLimit)
public PicOperations getPicOperations()
public void setPicOperations(PicOperations picOperations)
Copyright © 2023. All rights reserved.