cos:HeadObject. For more authorization information, see CAM-supported business APIs.Feature Name | Description | Example code |
Querying Metadata of Objects | Provides the feature of querying object metadata. |
String bucket = "examplebucket-1250000000"; // Bucket name. Format: BucketName-APPIDString cosPath = "exampleobject"; // The location identifier of the object in the bucket, i.e., the object key.HeadObjectRequest headObjectRequest = new HeadObjectRequest(bucket, cosPath);cosXmlService.headObjectAsync(headObjectRequest, new CosXmlResultListener() {@Overridepublic void onSuccess(CosXmlRequest request, CosXmlResult result) {HeadObjectResult headObjectResult = (HeadObjectResult) result;}// If you call the API using kotlin, note that the exception in the callback method must be nullable. Otherwise, the onFail method will not be called, as follows:// The type of clientException is CosXmlClientException?, and the type of serviceException is CosXmlServiceException?@Overridepublic void onFail(CosXmlRequest cosXmlRequest,@Nullable CosXmlClientException clientException,@Nullable CosXmlServiceException serviceException) {if (clientException != null) {clientException.printStackTrace();} else {serviceException.printStackTrace();}}});
Esta página foi útil?
Você também pode entrar em contato com a Equipe de vendas ou Enviar um tíquete em caso de ajuda.
comentários