FtpService.java 1016 Bytes
Newer Older
1 2 3 4 5 6
package cn.timer.api.service;

import cn.timer.api.dto.disk.FileInfoDto;
import com.jcraft.jsch.ChannelSftp;
import org.springframework.web.multipart.MultipartFile;

7 8
import java.io.File;
import java.io.OutputStream;
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
import java.util.List;

/**
 * 上传文件的实现层
 */
public interface FtpService {

    boolean createDirs(String dirPath, ChannelSftp sftp);

    /**
     * 上传文件到服务器
     * @param targetPath
     * @param files
     * @param reservedName
     * @return
     */
    List<FileInfoDto> uploadFile(String targetPath, MultipartFile[] files, boolean reservedName);
26 27 28 29 30 31 32 33 34
    /**
     * 下载单个文件
     *
     * @param remotePath:远程目录
     * @param localPath:本地保存目录
     * @param localFileName:保存文件名
     * @return
     */
    boolean downloadFile(String remotePath, String localPath, String localFileName);
35 36 37 38 39 40 41 42

    /**
     * 删除服务器文件
     * @param targetPath
     * @return
     */
    boolean deleteFile(List<String> targetPath);
}