package cc.smtweb.system.bpm.util.ftp;

import java.io.File;
import java.io.InputStream;

/**
 * Created by Akmm at 2015-12-08 14:33
 */
public interface IFtpUtil {
    //是否自动删除
    boolean isAutoFree();

    //设置自动删除
    void setAutoFree(boolean autoFree);

    //登录ftp
    boolean login(IFtpServerConfig ftpConf);

    //退出ftp
    void logout();

    //是否连接正常
    boolean isConnected();

    //设置远程目录
    boolean setRemoteDir(String path);

    void mkdir(String dirName);

    //删除远程路径
    void deleteFolder(String path);

    void downloadFile(String remotePath, String fileName, String localPath) throws Exception;

    void downloadFileEx(String remotePath, String fileName, String localFileName) throws Exception;

    InputStream downloadFile(String remotePath, String fileName) throws Exception;

    boolean uploadFile(String path, String filename, String localFileName) throws Exception;

    boolean uploadFile(String path, String filename, File localFile) throws Exception;

    void deleteFile(String path, String filename);

    //判断文件是否存在
    boolean existsFile(String path, String filename);

    //调用返回流的方法，在处理完流后，要调用此方法。
    boolean completePendingCommand();

    //断开连接
//    FTPFile[] listFiles(String remotePath) throws IOException;

    //枚举文件名
    String[] listFileNames(String remotePath) throws Exception;

    //枚举文件名,包含文件夹
    String[] listAllFileNames(String remotePath) throws Exception;

    //断开连接
    void disconnect();

    boolean rename(String remotePath, String from, String to) throws Exception;
}
