You've already forked FrameTour-BE
彻底铲除OSSUtil,抽象、修改
This commit is contained in:
41
src/main/java/com/ycwl/basic/storage/utils/StorageUtil.java
Normal file
41
src/main/java/com/ycwl/basic/storage/utils/StorageUtil.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package com.ycwl.basic.storage.utils;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public class StorageUtil {
|
||||
public static String joinPath(String path, String subPath) {
|
||||
if (StringUtils.isBlank(path)) {
|
||||
return subPath;
|
||||
}
|
||||
if (subPath.startsWith("/")) {
|
||||
subPath = subPath.substring(1);
|
||||
}
|
||||
if (path.endsWith("/")) {
|
||||
path = path.substring(0, path.length() - 1);
|
||||
}
|
||||
if (StringUtils.isBlank(subPath)) {
|
||||
return path;
|
||||
}
|
||||
if (path.endsWith("/")) {
|
||||
return path + subPath;
|
||||
} else {
|
||||
return path + "/" + subPath;
|
||||
}
|
||||
}
|
||||
|
||||
public static String joinPath(String ...names) {
|
||||
String name = names[0];
|
||||
for (int i = 1; i < names.length; i++) {
|
||||
name = joinPath(name, names[i]);
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
public static String joinPath(String name, String ...names) {
|
||||
for (String s : names) {
|
||||
name = joinPath(name, s);
|
||||
}
|
||||
return name;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user