use of com.qcloud.cos.model.AppendObjectResult in project cos-java-sdk-v5 by tencentyun.
the class AbstractCOSClientTest method testAppendGetDelObjectDiffSize.
protected void testAppendGetDelObjectDiffSize(long size, boolean isStream) throws IOException {
String key = "ut/" + size;
long nextAppendPosition = 0;
for (int i = 0; i < 3; i++) {
File localFile = buildTestFile(size);
AppendObjectRequest appendObjectRequest = null;
if (!isStream) {
appendObjectRequest = new AppendObjectRequest(bucket, key, localFile);
} else {
ObjectMetadata objectMetadata = new ObjectMetadata();
objectMetadata.setContentLength(size);
appendObjectRequest = new AppendObjectRequest(bucket, key, new FileInputStream(localFile), objectMetadata);
}
appendObjectRequest.setPosition(nextAppendPosition);
AppendObjectResult appendObjectResult = cosclient.appendObject(appendObjectRequest);
nextAppendPosition = appendObjectResult.getNextAppendPosition();
localFile.delete();
}
ObjectMetadata objectMetadata = cosclient.getObjectMetadata(bucket, key);
assertEquals(objectMetadata.getContentLength(), size * 3);
cosclient.deleteObject(bucket, key);
}
Aggregations