You must restore an Archive object before you read the object. This topic describes how to restore an Archive object.

Sample code

The following code provides an example on how to restore an Archive object:

// Restore the Archive object. 
RestoreObjectRequest restore = new RestoreObjectRequest();
// Specify the name of the bucket. Example: examplebucket. 
// Specify the full path of the object. Do not include the bucket name in the full path. Example: exampledir/exampleobject.txt. 
OSSAsyncTask task = oss.asyncRestoreObject(restore, new OSSCompletedCallback<RestoreObjectRequest,
        RestoreObjectResult>() {
    public void onSuccess(RestoreObjectRequest request, RestoreObjectResult result) {


    public void onFailure(RestoreObjectRequest request, ClientException clientException,
                          ServiceException serviceException) {
        OSSLog.logError("error: "+serviceException.getRawMessage());




  • For the complete sample code that is used to restore an Archive object, visit GitHub.
  • For more information about the API operation that you can call to restore an Archive object, see RestoreObject.