| | |
| | | import cn.hutool.core.io.IoUtil; |
| | | import cn.hutool.core.util.IdUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.ruoyi.oss.entity.UploadResult; |
| | | import com.ruoyi.oss.service.ICloudStorageService; |
| | | import org.springframework.beans.factory.InitializingBean; |
| | | |
| | |
| | | * @author Lion Li |
| | | */ |
| | | public abstract class AbstractCloudStorageService implements ICloudStorageService, InitializingBean { |
| | | |
| | | @Override |
| | | public abstract void createBucket(); |
| | | |
| | | @Override |
| | | public abstract String getServiceType(); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public abstract String upload(byte[] data, String path); |
| | | public abstract UploadResult upload(byte[] data, String path, String contentType); |
| | | |
| | | @Override |
| | | public abstract void delete(String path); |
| | | |
| | | @Override |
| | | public String upload(InputStream inputStream, String path) { |
| | | public UploadResult upload(InputStream inputStream, String path, String contentType) { |
| | | byte[] data = IoUtil.readBytes(inputStream); |
| | | return this.upload(data, path); |
| | | return this.upload(data, path, contentType); |
| | | } |
| | | |
| | | @Override |
| | | public abstract String uploadSuffix(byte[] data, String suffix); |
| | | public abstract UploadResult uploadSuffix(byte[] data, String suffix, String contentType); |
| | | |
| | | @Override |
| | | public abstract String uploadSuffix(InputStream inputStream, String suffix); |
| | | public abstract UploadResult uploadSuffix(InputStream inputStream, String suffix, String contentType); |
| | | |
| | | @Override |
| | | public abstract void afterPropertiesSet() throws Exception; |
| | | |
| | | @Override |
| | | public abstract String getEndpointLink(); |
| | | } |