All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.yupaits.yutool.file.utils.MinioUtils Maven / Gradle / Ivy

There is a newer version: 1.2.4
Show newest version
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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy