Help Center> Object Storage Service> Java> FAQs (SDK for Java)> How Do I Confirm That the Uploaded Object Has Overwritten the Existing Object in the Bucket with the Same Name? (Java SDK)
Updated on 2024-01-16 GMT+08:00

How Do I Confirm That the Uploaded Object Has Overwritten the Existing Object in the Bucket with the Same Name? (Java SDK)

After the upload is complete, you can call ObsClient.getObjectMetadata to obtain the size and last modification time of the target object and compare them with those in the data source. If the sizes are the same and the last modification time of the target object is later than that of the data source, the upload is successful. Otherwise, the upload fails. For details about how to call ObsClient.getObjectMetadata, see Obtaining Object Metadata (SDK for Java).