AbstractFYunFileService.java 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. package com.fdkankan.fyun.face;
  2. import com.fdkankan.fyun.config.FYunFileConfig;
  3. import org.springframework.beans.factory.annotation.Autowired;
  4. import org.springframework.stereotype.Component;
  5. import java.io.IOException;
  6. import java.util.List;
  7. import java.util.Map;
  8. @Component
  9. public abstract class AbstractFYunFileService implements FYunFileServiceInterface {
  10. @Autowired
  11. public FYunFileConfig fYunFileConfig;
  12. @Override
  13. public void uploadFile(byte[] data, String remoteFilePath) throws Exception {
  14. uploadFile(fYunFileConfig.getBucket(), data, remoteFilePath);
  15. }
  16. @Override
  17. public void uploadFile(String filePath, String remoteFilePath) throws Exception {
  18. uploadFile(fYunFileConfig.getBucket(), filePath, remoteFilePath);
  19. }
  20. @Override
  21. public void uploadFileByCommand(String filePath, String remoteFilePath) throws Exception {
  22. uploadFileByCommand(fYunFileConfig.getBucket(), filePath, remoteFilePath);
  23. }
  24. @Override
  25. public void deleteFile(String remoteFilePath) throws IOException {
  26. deleteFile(fYunFileConfig.getBucket(), remoteFilePath);
  27. }
  28. @Override
  29. public void deleteFolder(String remoteFolderPath) throws Exception {
  30. deleteFolder(fYunFileConfig.getBucket(), remoteFolderPath);
  31. }
  32. @Override
  33. public void uploadMulFiles(Map<String, String> filepaths) throws Exception {
  34. uploadMulFiles(fYunFileConfig.getBucket(), filepaths);
  35. }
  36. @Override
  37. public List<String> listRemoteFiles(String sourcePath) throws Exception {
  38. return listRemoteFiles(fYunFileConfig.getBucket(), sourcePath);
  39. }
  40. @Override
  41. public void copyFileBetweenFyun(String sourcePath, String targetBucketName, String targetPath) throws Exception {
  42. copyFileBetweenFyun(fYunFileConfig.getBucket(),sourcePath, targetBucketName, targetPath);
  43. }
  44. @Override
  45. public void copyFilesBetweenFyun(String targetBucketName, Map<String, String> pathMap) throws Exception {
  46. copyFilesBetweenFyun(fYunFileConfig.getBucket(),targetBucketName,pathMap);
  47. }
  48. @Override
  49. public String getFileContent(String remoteFilePath) throws Exception {
  50. return getFileContent(fYunFileConfig.getBucket(), remoteFilePath);
  51. }
  52. @Override
  53. public boolean fileExist(String objectName) throws Exception {
  54. return fileExist(fYunFileConfig.getBucket(), objectName);
  55. }
  56. @Override
  57. public void downloadFile(String remoteFilePath, String localPath) throws Exception {
  58. downloadFile(fYunFileConfig.getBucket(),remoteFilePath,localPath);
  59. }
  60. }