You can use resumable upload to split a file you want to upload into several parts and upload them simultaneously. After you have uploaded all parts, you can combine these parts into a complete object. Thus, you can complete uploading the entire object.

For more information about resumable upload, see Resumable upload in the OSS Developer Guide. For the complete code of resumable upload, see GitHub.

Run the following code for resumable upload:

// This example uses endpoint China East 1 (Hangzhou). Specify the actual endpoint based on your requirements.
String endpoint = "";
// It is highly risky to log on with AccessKey of an Alibaba Cloud account because the account has permissions on all the APIs in OSS. We recommend that you log on as a RAM user to access APIs or perform routine operations and maintenance. To create a RAM account, log on to
String accessKeyId = "<yourAccessKeyId>";
String accessKeySecret = "<yourAccessKeySecret>";

// Create an OSSClient instance.
OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);

ObjectMetadata meta = new ObjectMetadata();
// Specify the content type of the object you want to upload.

// Configure parameters with UploadFileRequest.
UploadFileRequest uploadFileRequest = new UploadFileRequest("<yourBucketName>","<yourObjectName>");

// Configure parameters with UploadFileRequest.
// Specify the bucket name.
// Specify the object name.
// Specify the local file you want to upload.
// Specify the number of threads for simultaneous upload. The default value is 1.
// Specify the size of a part you want to upload. The value can be from 100 KB to 5 GB. The default size of a part is calculated as: file size/10,000.
uploadFileRequest.setPartSize(1 * 1024 * 1024);
// Start resumable upload (that is disabled by default.).
// Configure the file used to record the result of local part uploads. You need to configure this parameter when you enable resumable upload. This file stores progress information. If a part upload fails, it can be continued based on the progress information recorded in this file. After you have uploaded the file, the file is deleted. By default, this file shares the same directory (uploadFile.ucp) as the file you want to upload.
// Configure object meta.
// Configure callback. Set the yourCallbackEvent parameter to Callback.

// Start resumable upload.

// Close your OSSClient.