Modifying an Object
If you have any questions during development, post them on the Issues page of GitHub. For details about parameters and usage of each API, see the API Reference
You can use ObsClient.modifyObject to modify the data of an object.
The sample code is as follows:
String endPoint = "https://your-endpoint";
String ak = "*** Provide your Access Key ***";
String sk = "*** Provide your Secret Key ***";
// Create an instance of ObsClient.
ObsClient obsClient = new ObsClient(ak, sk, endPoint);
// The first upload
ModifyObjectRequest request = new ModifyObjectRequest();
request.setBucketName("bucketname");
request.setObjectKey("objectname");
request.setPosition(0);
request.setInput(new ByteArrayInputStream("HELLO OBS FIRST".getBytes()));
ModifyObjectResult result = obsClient.modifyObject(request);
// The second upload for modification
request.setPosition(0);
request.setInput(new ByteArrayInputStream("hello obs second".getBytes()));
result = obsClient.modifyObject(request);
- This API is supported only in the parallel file system.
- The size of the content to be modified at a time cannot exceed 5 GB.
- In this example, an object is uploaded by using the modifyObject method, and then the content of the object is modified.
Last Article: Listing Parallel File Systems
Next Article: Renaming an Object
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.