review code.
This commit is contained in:
@@ -12,11 +12,6 @@ public class Const implements com.orion.lang.constant.Const {
|
||||
private Const() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 同 ${orion.version} 迭代时候需要手动更改
|
||||
*/
|
||||
public static String VERSION = "1.0.0";
|
||||
|
||||
public static final Integer NOT_DELETE = 0;
|
||||
|
||||
public static final Integer IS_DELETED = 1;
|
||||
|
||||
@@ -9,12 +9,15 @@ package com.orion.ops.framework.common.constant;
|
||||
*/
|
||||
public interface OrionOpsProConst {
|
||||
|
||||
/**
|
||||
* 同 ${orion.version} 迭代时候需要手动更改
|
||||
*/
|
||||
String VERSION = "1.0.0";
|
||||
|
||||
String GITHUB = "https://github.com/lijiahangmax/orion-ops-pro";
|
||||
|
||||
String GITEE = "https://gitee.com/lijiahangmax/orion-ops-pro";
|
||||
|
||||
String ISSUES = "https://gitee.com/lijiahangmax/orion-ops-pro/issues";
|
||||
|
||||
String VERSION = "1.0.0";
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.orion.ops.framework.common.file;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* 文件客户端
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/6/30 16:51
|
||||
*/
|
||||
public interface FileClient {
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
*
|
||||
* @param path 文件路径
|
||||
* @param content 文件内容
|
||||
* @return 路径
|
||||
* @throws Exception Exception
|
||||
*/
|
||||
String upload(String path, byte[] content) throws Exception;
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
*
|
||||
* @param path 文件路径
|
||||
* @param content 文件内容
|
||||
* @param overrideIfExist 文件存在是否覆盖
|
||||
* @return 路径
|
||||
* @throws Exception Exception
|
||||
*/
|
||||
String upload(String path, byte[] content, boolean overrideIfExist) throws Exception;
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
*
|
||||
* @param path 文件路径
|
||||
* @param in in
|
||||
* @return 路径
|
||||
* @throws Exception Exception
|
||||
*/
|
||||
String upload(String path, InputStream in) throws Exception;
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
*
|
||||
* @param path 文件路径
|
||||
* @param in in
|
||||
* @param autoClose autoClose
|
||||
* @return 路径
|
||||
* @throws Exception Exception
|
||||
*/
|
||||
String upload(String path, InputStream in, boolean autoClose) throws Exception;
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
*
|
||||
* @param path 文件路径
|
||||
* @param in in
|
||||
* @param autoClose autoClose
|
||||
* @param overrideIfExist 文件存在是否覆盖
|
||||
* @return 路径
|
||||
* @throws Exception Exception
|
||||
*/
|
||||
String upload(String path, InputStream in, boolean autoClose, boolean overrideIfExist) throws Exception;
|
||||
|
||||
// TODO getOutputStream
|
||||
|
||||
/**
|
||||
* 检测文件是否存在
|
||||
*
|
||||
* @param path path
|
||||
* @return 是否存在
|
||||
*/
|
||||
boolean isExists(String path);
|
||||
|
||||
/**
|
||||
* 删除文件
|
||||
*
|
||||
* @param path 路径
|
||||
* @return 是否删除
|
||||
* @throws Exception Exception
|
||||
*/
|
||||
boolean delete(String path) throws Exception;
|
||||
|
||||
/**
|
||||
* 获取文件内容
|
||||
*
|
||||
* @param path path
|
||||
* @return bytes
|
||||
* @throws Exception Exception
|
||||
*/
|
||||
byte[] getContent(String path) throws Exception;
|
||||
|
||||
/**
|
||||
* 获取文件输入流
|
||||
*
|
||||
* @param path path
|
||||
* @return stream
|
||||
* @throws Exception Exception
|
||||
*/
|
||||
InputStream getContentInputStream(String path) throws Exception;
|
||||
|
||||
}
|
||||
@@ -4,6 +4,8 @@ import com.orion.ops.framework.common.crypto.ValueCrypto;
|
||||
|
||||
/**
|
||||
* 加密工具类
|
||||
* <p>
|
||||
* PrimaryValueCrypto 代理类工具
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
@@ -13,6 +15,9 @@ public class CryptoUtils {
|
||||
|
||||
private static ValueCrypto delegate;
|
||||
|
||||
private CryptoUtils() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 加密
|
||||
*
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
package com.orion.ops.framework.common.utils;
|
||||
|
||||
import com.orion.ops.framework.common.file.FileClient;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* 文件客户端工具
|
||||
* <p>
|
||||
* PrimaryFileClient 代理类工具
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/7/21 12:05
|
||||
*/
|
||||
public class FileClientUtils {
|
||||
|
||||
private static FileClient delegate;
|
||||
|
||||
private FileClientUtils() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
*
|
||||
* @param path 文件路径
|
||||
* @param content 文件内容
|
||||
* @return 路径
|
||||
* @throws Exception Exception
|
||||
*/
|
||||
public static String upload(String path, byte[] content) throws Exception {
|
||||
return delegate.upload(path, content);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
*
|
||||
* @param path 文件路径
|
||||
* @param content 文件内容
|
||||
* @param overrideIfExist 文件存在是否覆盖
|
||||
* @return 路径
|
||||
* @throws Exception Exception
|
||||
*/
|
||||
public static String upload(String path, byte[] content, boolean overrideIfExist) throws Exception {
|
||||
return delegate.upload(path, content, overrideIfExist);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
*
|
||||
* @param path 文件路径
|
||||
* @param in in
|
||||
* @return 路径
|
||||
* @throws Exception Exception
|
||||
*/
|
||||
public static String upload(String path, InputStream in) throws Exception {
|
||||
return delegate.upload(path, in);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
*
|
||||
* @param path 文件路径
|
||||
* @param in in
|
||||
* @param autoClose autoClose
|
||||
* @return 路径
|
||||
* @throws Exception Exception
|
||||
*/
|
||||
public static String upload(String path, InputStream in, boolean autoClose) throws Exception {
|
||||
return delegate.upload(path, in, autoClose);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
*
|
||||
* @param path 文件路径
|
||||
* @param in in
|
||||
* @param autoClose autoClose
|
||||
* @param overrideIfExist 文件存在是否覆盖
|
||||
* @return 路径
|
||||
* @throws Exception Exception
|
||||
*/
|
||||
public static String upload(String path, InputStream in, boolean autoClose, boolean overrideIfExist) throws Exception {
|
||||
return delegate.upload(path, in, autoClose, overrideIfExist);
|
||||
}
|
||||
|
||||
// TODO getOutputStream
|
||||
|
||||
/**
|
||||
* 检测文件是否存在
|
||||
*
|
||||
* @param path path
|
||||
* @return 是否存在
|
||||
*/
|
||||
public static boolean isExists(String path) {
|
||||
return delegate.isExists(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文件
|
||||
*
|
||||
* @param path 路径
|
||||
* @return 是否删除
|
||||
* @throws Exception Exception
|
||||
*/
|
||||
public static boolean delete(String path) throws Exception {
|
||||
return delegate.delete(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件内容
|
||||
*
|
||||
* @param path path
|
||||
* @return bytes
|
||||
* @throws Exception Exception
|
||||
*/
|
||||
public static byte[] getContent(String path) throws Exception {
|
||||
return delegate.getContent(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件输入流
|
||||
*
|
||||
* @param path path
|
||||
* @return stream
|
||||
* @throws Exception Exception
|
||||
*/
|
||||
public static InputStream getContentInputStream(String path) throws Exception {
|
||||
return delegate.getContentInputStream(path);
|
||||
}
|
||||
|
||||
public static void setDelegate(FileClient delegate) {
|
||||
FileClientUtils.delegate = delegate;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user