com.baidubce.services.bos.model
Class AppendObjectRequest

java.lang.Object
  extended by com.baidubce.model.AbstractBceRequest
      extended by com.baidubce.services.bos.model.GenericBucketRequest
          extended by com.baidubce.services.bos.model.GenericObjectRequest
              extended by com.baidubce.services.bos.model.PutObjectRequest
                  extended by com.baidubce.services.bos.model.AppendObjectRequest

public class AppendObjectRequest
extends PutObjectRequest

Uploads a new object to the specified Baidu Bos bucket. The AppendObjectRequest optionally uploads object metadata and applies a canned access control policy to the new object.

Baidu Bos never stores partial objects; if during this call an exception wasn't thrown, the entire object was stored.


Constructor Summary
AppendObjectRequest(String bucketName, String key, File file)
          Constructs a new AppendObjectRequest object to upload a file to the specified bucket and key.
AppendObjectRequest(String bucketName, String key, File file, ObjectMetadata metadata)
          Constructs a new AppendObjectRequest object to upload an appendable file to the specified bucket and key.
AppendObjectRequest(String bucketName, String key, InputStream inputStream)
          Constructs a new AppendObjectRequest object to upload a stream of data to the specified bucket and key.
AppendObjectRequest(String bucketName, String key, InputStream inputStream, ObjectMetadata metadata)
          Constructs a new AppendObjectRequest object to upload a stream of data to the specified bucket and key.
 
Method Summary
 Long getOffset()
          Gets the offset of the file, which shows the resume position of appendable file.
 void setOffset(Long offset)
          Sets the offset of the file, which shows the resume position of appendable file.
 AppendObjectRequest withBucketName(String bucketName)
          Sets the name of the bucket where this request will upload a new object to.
 AppendObjectRequest withFile(File file)
          Sets the file containing the data to be uploaded to Baidu Bos.
 AppendObjectRequest withInputStream(InputStream inputStream)
          Sets the input stream containing the data to be uploaded to Baidu Bos.
 AppendObjectRequest withKey(String key)
          Sets the key under which to store the new object.
 AppendObjectRequest withObjectMetadata(ObjectMetadata objectMetadata)
          Sets the optional metadata instructing Baidu Bos how to handle the uploaded data (e.g.
 AppendObjectRequest withOffset(Long offset)
          Sets the offset of the file, which shows the resume position of appendable file.
 AppendObjectRequest withRequestCredentials(BceCredentials credentials)
          Sets the optional credentials to use for this request, overriding the default credentials set at the client level.
 
Methods inherited from class com.baidubce.services.bos.model.PutObjectRequest
getFile, getInputStream, getObjectMetadata, getStorageClass, setFile, setInputStream, setObjectMetadata, setStorageClass, withStorageClass
 
Methods inherited from class com.baidubce.services.bos.model.GenericObjectRequest
getKey, setKey
 
Methods inherited from class com.baidubce.services.bos.model.GenericBucketRequest
getBucketName, setBucketName
 
Methods inherited from class com.baidubce.model.AbstractBceRequest
getRequestCredentials, setRequestCredentials
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AppendObjectRequest

public AppendObjectRequest(String bucketName,
                           String key,
                           File file)
Constructs a new AppendObjectRequest 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 Baidu Bos.

AppendObjectRequest

public AppendObjectRequest(String bucketName,
                           String key,
                           File file,
                           ObjectMetadata metadata)
Constructs a new AppendObjectRequest object to upload an appendable 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 Baidu Bos.
metadata - The object metadata. At minimum this specifies the content length for the stream of data being uploaded.

AppendObjectRequest

public AppendObjectRequest(String bucketName,
                           String key,
                           InputStream inputStream)
Constructs a new AppendObjectRequest 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.

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.
inputStream - The stream of data to upload to Baidu Bos.

AppendObjectRequest

public AppendObjectRequest(String bucketName,
                           String key,
                           InputStream inputStream,
                           ObjectMetadata metadata)
Constructs a new AppendObjectRequest 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.

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.
inputStream - The stream of data to upload to Baidu Bos.
metadata - The object metadata. At minimum this specifies the content length for the stream of data being uploaded.
Method Detail

getOffset

public Long getOffset()
Gets the offset of the file, which shows the resume position of appendable file.

Returns:
The offset that indicates the size of data has been uploaded to Baidu bos.

setOffset

public void setOffset(Long offset)
Sets the offset of the file, which shows the resume position of appendable file.

Parameters:
offset - The offset indicates the size of data has been uploaded to Baidu bos.

withOffset

public AppendObjectRequest withOffset(Long offset)
Sets the offset of the file, which shows the resume position of appendable file.

Parameters:
offset - The offset indicates the size of data has been uploaded to Baidu bos.
Returns:
This AppendObjectRequest, so that additional method calls to be chained together.

withObjectMetadata

public AppendObjectRequest withObjectMetadata(ObjectMetadata objectMetadata)
Sets the optional metadata instructing Baidu Bos how to handle the uploaded data (e.g. custom user metadata, hooks for specifying content type, etc.). Returns this AppendObjectRequest, 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 Baidu Bos. This can cause very negative performance impacts.

Overrides:
withObjectMetadata in class PutObjectRequest
Parameters:
objectMetadata - The optional metadata instructing Baidu Bos how to handle the uploaded data (e.g. custom user metadata, hooks for specifying content type, etc.).
Returns:
This AppendObjectRequest, so that additional method calls to be chained together.

withFile

public AppendObjectRequest withFile(File file)
Sets the file containing the data to be uploaded to Baidu Bos. Returns this AppendObjectRequest, enabling additional method calls to be chained together.

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

Overrides:
withFile in class PutObjectRequest
Parameters:
file - The file containing the data to be uploaded to Baidu Bos.
Returns:
This AppendObjectRequest, enabling additional method calls to be chained together.

withInputStream

public AppendObjectRequest withInputStream(InputStream inputStream)
Sets the input stream containing the data to be uploaded to Baidu Bos. Returns this AppendObjectRequest, enabling additional method calls to be chained together.

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

Overrides:
withInputStream in class PutObjectRequest
Parameters:
inputStream - The InputStream containing the data to be uploaded to Baidu Bos.
Returns:
This AppendObjectRequest, so that additional method calls can be chained together.

withRequestCredentials

public AppendObjectRequest withRequestCredentials(BceCredentials credentials)
Sets the optional credentials to use for this request, overriding the default credentials set at the client level.

Overrides:
withRequestCredentials in class PutObjectRequest
Parameters:
credentials - The optional BOS security credentials to use for this request.
Returns:
This AppendObjectRequest, so that additional method calls can be chained together.

withBucketName

public AppendObjectRequest 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.

Overrides:
withBucketName in class PutObjectRequest
Parameters:
bucketName - The name of an existing bucket where this request will upload a new object to.
Returns:
This AppendObjectRequest, enabling additional method calls to be chained together.

withKey

public AppendObjectRequest withKey(String key)
Sets the key under which to store the new object. Returns this object, enabling additional method calls to be chained together.

Overrides:
withKey in class PutObjectRequest
Parameters:
key - The key under which to store the new object.
Returns:
This AppendObjectRequest, so that additional method calls to be chained together.


Copyright © 2018. All rights reserved.