Skip to content

Multipart uploads ​

The caller controls each upload session. Save its bucket, key, and upload ID if you need to resume after a restart.

java
ObjectStorageClient.MultipartUpload upload =
    storage.createMultipartUpload("photos", "videos/clip.mp4", "video/mp4");

try {
    List<ObjectStorageClient.Part> parts = storage.uploadFileParts(
        upload, file, 8 * 1024 * 1024);
    String etag = storage.completeMultipartUpload(upload, parts);
} catch (IOException failure) {
    // Keep upload.uploadId() for inspection, retry, or explicit abort.
    throw failure;
}

uploadFileParts sends sequential parts, returns their part numbers and server ETags, and does not complete the upload. Its part size must be 5–128 MiB and a file must produce 1–10,000 parts. It holds one part in memory at a time. Do not modify the source file during upload or resume.

For manual control, call uploadPart(upload, partNumber, bytes). Part numbers are 1–10,000; keep the returned Part, especially its ETag. completeMultipartUpload(upload, parts) sorts and sends those exact part numbers and ETags, then returns the completed object's ETag. It requires at least one part and rejects duplicate part numbers.

Resume or clean up ​

listParts(upload, partNumberMarker, maxParts) returns a page of uploaded parts. Start with marker 0; when truncated() is true, pass nextPartNumberMarker() to the next call. maxParts must be 1–1000.

listMultipartUploads(bucket, prefix, keyMarker, uploadIdMarker, maxUploads) lists unfinished sessions one page at a time. Both markers start as null; when truncated, pass both nextKeyMarker() and nextUploadIdMarker(). maxUploads must be 1–1000. An upload ID marker requires a key marker.

abortMultipartUpload(upload) removes an unfinished session. A completed upload cannot be aborted. A failed part transfer or lost completion response has an uncertain outcome: inspect the session or object before retrying.