浏览代码

完善文件下载接口

tianboguang 3 年之前
父节点
当前提交
e6ed50e49e
共有 1 个文件被更改,包括 236 次插入0 次删除
  1. 236 0
      4dkankan-utils-fyun-parent/src/main/java/com/fdkankan/fyun/face/FYunFileService.java

+ 236 - 0
4dkankan-utils-fyun-parent/src/main/java/com/fdkankan/fyun/face/FYunFileService.java

@@ -0,0 +1,236 @@
+package com.fdkankan.fyun.face;
+
+import org.springframework.stereotype.Component;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+@Component
+public interface FYunFileService {
+
+	/**
+	 *  上传文件
+	 * @param bucket 目标bucket
+	 * @param data 上传的数据
+	 * @param remoteFilePath 上传后的文件路径
+	 * @throws Exception
+	 */
+	void uploadFile(String bucket, byte[] data, String remoteFilePath) throws Exception;
+
+	/**
+	 *  上传文件至系统默认bucket
+	 * @param data 上传的数据
+	 * @param remoteFilePath 上传后的文件路径
+	 * @throws Exception
+	 */
+	void uploadFile(byte[] data, String remoteFilePath) throws Exception;
+
+
+	/**
+	 * 上传本地文件
+	 * @param bucket 目标bucket
+	 * @param filePath 本地路径
+	 * @param remoteFilePath 上传后的文件路径
+	 * @throws Exception
+	 */
+	void uploadFile(String bucket, String filePath, String remoteFilePath) throws Exception;
+
+	/**
+	 * 上传本地文件至系统默认bucket
+	 * @param filePath 本地路径
+	 * @param remoteFilePath 上传后的文件路径
+	 * @throws Exception
+	 */
+	void uploadFile(String filePath, String remoteFilePath) throws Exception;
+
+	/**
+	 * 通过本地脚本上传
+	 *
+	 * @param filePath
+	 * @param remoteFilePath
+	 */
+	void uploadFileByCommand(String bucket, String filePath, String remoteFilePath) throws Exception;
+
+	/**
+	 * 通过本地脚本上传至系统默认bucket
+	 *
+	 * @param filePath
+	 * @param remoteFilePath
+	 */
+	void uploadFileByCommand(String filePath, String remoteFilePath) throws Exception;
+
+	/**
+	 * 删除服务器文件
+	 * @param bucket
+	 * @param remoteFilePath
+	 * @throws IOException
+	 */
+	void deleteFile(String bucket, String remoteFilePath) throws IOException;
+
+	/**
+	 * 删除系统默认bucket服务器文件
+	 * @param remoteFilePath
+	 * @throws IOException
+	 */
+	void deleteFile(String remoteFilePath) throws IOException;
+
+	/**
+	 * 删除目录
+	 * @param bucket
+	 * @param remoteFolderPath
+	 * @return
+	 */
+	void deleteFolder(String bucket, String remoteFolderPath) throws Exception;
+
+	/**
+	 * 删除系统默认bucket目录
+	 * @param remoteFolderPath
+	 * @return
+	 */
+	void deleteFolder(String remoteFolderPath) throws Exception;
+
+
+	/**
+	 * 上传多个文件
+	 * @param bucket
+	 * @param filepaths :key 本地路径,value,服务器文件路径
+	 * @throws Exception
+	 */
+	void uploadMulFiles(String bucket, Map<String, String> filepaths) throws Exception;
+
+	/**
+	 * 上传多个文件至系统默认bucket
+	 * @param filepaths :key 本地路径,value,服务器文件路径
+	 * @throws Exception
+	 */
+	void uploadMulFiles(Map<String, String> filepaths) throws Exception;
+
+
+	/**
+	 * 获取文件类型
+	 * @param remoteFolderPath 服务器文件路径
+	 * @return
+	 * @throws Exception
+	 */
+	String getContentType(String remoteFolderPath) throws Exception;
+
+	/**
+	 * 获取文件列表
+	 * @param bucket
+	 * @param sourcePath
+	 * @return
+	 * @throws Exception
+	 */
+	List<String> listRemoteFiles(String bucket, String sourcePath) throws Exception;
+
+	/**
+	 * 获取默认bucket文件列表
+	 * @param sourcePath
+	 * @return
+	 * @throws Exception
+	 */
+	List<String> listRemoteFiles(String sourcePath) throws Exception;
+
+
+	/**
+	 * <p>
+	 * 拷贝目录
+	 * </p>
+	 *
+	 * @param sourcePath
+	 * @param targetPath
+	 * @author dengsixing
+	 * @date 2022/1/18
+	 **/
+	void copyFileBetweenFyun(String sourceBucketName, String sourcePath, String targetBucketName, String targetPath) throws Exception;
+
+	/**
+	 * <p>
+	 * 拷贝系统bucket目录至指定bucket
+	 * </p>
+	 *
+	 * @param sourcePath
+	 * @param targetPath
+	 * @author dengsixing
+	 * @date 2022/1/18
+	 **/
+	void copyFileBetweenFyun(String sourcePath, String targetBucketName, String targetPath) throws Exception;
+
+	/**
+	 * <p>
+	 * 拷贝目录
+	 * </p>
+	 *
+	 * @param sourcePath
+	 * @param targetPath
+	 * @author dengsixing
+	 * @date 2022/1/18
+	 **/
+	void copyFilesBetweenFyun(String sourceBucketName,String targetBucketName, Map<String,String> pathMap) throws Exception;
+
+	/**
+	 * <p>
+	 * 拷贝系统bucket目录至指定bucket
+	 * </p>
+	 *
+	 * @param targetBucketName
+	 * @param pathMap
+	 * @author dengsixing
+	 * @date 2022/1/18
+	 **/
+	void copyFilesBetweenFyun(String targetBucketName,Map<String,String> pathMap) throws Exception;
+
+
+	/**
+	 * 获取文件内容
+	 *
+	 * @param bucketName
+	 * @param remoteFilePath
+	 * @return
+	 */
+	String getFileContent(String bucketName, String remoteFilePath) throws Exception;
+
+	/**
+	 * 获取默认bucket内容
+	 *
+	 * @param remoteFilePath
+	 * @return
+	 */
+	String getFileContent(String remoteFilePath) throws Exception;
+
+
+	/**
+	 * 判断文件是否存在
+	 *
+	 * @param objectName
+	 * @return
+	 */
+	boolean fileExist(String bucket, String objectName) throws Exception;
+
+	/**
+	 * 判断默认bucket文件是否存在
+	 *
+	 * @param objectName
+	 * @return
+	 */
+	boolean fileExist(String objectName) throws Exception;
+
+	/**
+	 * 从指定bucket下载文件
+	 *
+	 * @param bucket
+	 * @param remoteFilePath
+	 * @param localPath
+	 * @return
+	 */
+	public void downloadFile(String bucket, String remoteFilePath, String localPath) throws Exception;
+
+	/**
+	 * 从系统默认bucket下载文件
+	 * @param remoteFilePath
+	 * @param localPath
+	 * @throws Exception
+	 */
+	public void downloadFile(String remoteFilePath, String localPath) throws Exception;
+}