use of org.springblade.core.oss.model.OssFile in project blade-tool by chillzhuang.
the class AliossTemplate method statFile.
@SneakyThrows
public OssFile statFile(String bucketName, String fileName) {
ObjectMetadata stat = ossClient.getObjectMetadata(getBucketName(bucketName), fileName);
OssFile ossFile = new OssFile();
ossFile.setName(fileName);
ossFile.setLink(fileLink(ossFile.getName()));
ossFile.setHash(stat.getContentMD5());
ossFile.setLength(stat.getContentLength());
ossFile.setPutTime(stat.getLastModified());
ossFile.setContentType(stat.getContentType());
return ossFile;
}
use of org.springblade.core.oss.model.OssFile in project blade-tool by chillzhuang.
the class QiniuTemplate method statFile.
@SneakyThrows
public OssFile statFile(String bucketName, String fileName) {
FileInfo stat = bucketManager.stat(getBucketName(bucketName), fileName);
OssFile ossFile = new OssFile();
ossFile.setName(stat.key);
ossFile.setName(Func.isEmpty(stat.key) ? fileName : stat.key);
ossFile.setLink(fileLink(ossFile.getName()));
ossFile.setHash(stat.hash);
ossFile.setLength(stat.fsize);
ossFile.setPutTime(new Date(stat.putTime / 10000));
ossFile.setContentType(stat.mimeType);
return ossFile;
}
Aggregations