JAVA determine whether a file exists OSS

/ ** 
* determine whether a file exists
* @param remoteFileName
* @return
* 2018 Nian 11 Yue 23 Ri
* /
public static Boolean DoesObjectExist (String remoteFileName) {
// Endpoint A Case Study, other region according to the actual situation fill
String endpoint = "";
// cloud account AccessKey have all API access, it is recommended to follow Ali cloud security best practices, create and use sub-accounts RAM API access or daily operation and maintenance, please login
String accessKeyId = "";
String = accessKeySecret " ";
// create OSSClient instance
OSSClient ossClient = new new OSSClient (Endpoint, accessKeyId, accessKeySecret);
Boolean the Result = ossClient.doesObjectExist (bucketName, remoteFileName);
// close OSSClient.
ossClient.shutdown ();
return Result;
}

Guess you like

Origin www.cnblogs.com/yyhhblog/p/11283118.html