use of software.amazon.awssdk.core.sync.RequestBody in project aws-doc-sdk-examples by awsdocs.
the class PutObject method putMediaObject.
// snippet-start:[mediastore.java2.put_object.main]
public static void putMediaObject(MediaStoreDataClient mediaStoreData, String filePath, String completePath) {
try {
File myFile = new File(filePath);
RequestBody requestBody = RequestBody.fromFile(myFile);
PutObjectRequest objectRequest = PutObjectRequest.builder().path(completePath).contentType("video/mp4").build();
PutObjectResponse response = mediaStoreData.putObject(objectRequest, requestBody);
System.out.println("The saved object is " + response.storageClass().toString());
} catch (MediaStoreDataException e) {
System.err.println(e.awsErrorDetails().errorMessage());
System.exit(1);
}
}
Aggregations