com.yupaits.yutool.file.utils.MinioUtils Maven / Gradle / Ivy
package com.yupaits.yutool.file.utils;
import org.apache.commons.lang3.StringUtils;
/**
* Minio工具类
* @author yupaits
* @date 2020/3/15
*/
public class MinioUtils {
private static final String PATH_SEPARATOR = "/";
private MinioUtils() {
}
/**
* 获取BucketName
* @param fullPath 文件下载全路径
* @return BucketName
*/
public static String getBucketName(String fullPath) {
if (StringUtils.isNotBlank(fullPath)) {
return StringUtils.substringBefore(fullPath, PATH_SEPARATOR);
}
return null;
}
/**
* 获取ObjectName
* @param fullPath 文件下载全路径
* @return ObjectName
*/
public static String getObjectName(String fullPath) {
if (StringUtils.isNotBlank(fullPath)) {
return StringUtils.substringAfter(fullPath, PATH_SEPARATOR);
}
return null;
}
}