/**
 * Copyright 2008-2009. Chongqing Communications Industry Services Co.,Ltd Information Technology Branch. All rights reserved.
 * <a>http://www.crunii.com</a>
 */
package com.crunii.micro.common.ftp;

import java.io.InputStream;
import java.io.OutputStream;

/**
 * <pre>支持ftp和sftp</pre>
 *
 * @author 田平 create 2021/9/22 16:07
 */
public interface RemoteFile {

	/**
	 * <pre>
	 * 上传本地文件到远程目录，远程目录不存在自动创建
	 * </pre>
	 *
	 * @param remotePath
	 * @param remoteName
	 * @param localFilePath
	 */
	public void uploadFile(String remotePath, String remoteName, String localFilePath);

	/**
	 * <pre>
	 * 上传本地文件流到远程目录，远程目录不存在自动创建
	 * </pre>
	 *
	 * @param remotePath
	 * @param remoteName
	 * @param in
	 */
	public void uploadFile(String remotePath, String remoteName, InputStream in);

	/**
	 * <pre>
	 * 下载远程文件的字节流
	 * </pre>
	 *
	 * @param remotePath
	 * @param remoteName
	 * @return
	 */
	public byte[] getFileBytes(String remotePath, String remoteName);

	/**
	 * 拷贝字节流到输入流
	 *
	 * @param remotePath
	 * @param remoteName
	 * @param output
	 * @return 拷贝大小
	 */
	public int copyToOutputStream(String remotePath, String remoteName, OutputStream output);

	/**
	 * 范围copy
	 *
	 * @param remotePath
	 * @param remoteName
	 * @param start
	 * @param end
	 * @param output
	 * @return
	 */
	public int copyRange(String remotePath, String remoteName, int start, int end, OutputStream output);

	/**
	 * <pre>
	 * 下载远程文件到本地
	 * </pre>
	 *
	 * @param remotePath
	 * @param remoteName
	 * @param localFilePath
	 * @param localFileName
	 */
	public void downloadFile(String remotePath, String remoteName, String localFilePath, String localFileName);

}
