mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
FTP新增读取远程文件输入流方法
This commit is contained in:
@@ -16,10 +16,13 @@ import org.apache.commons.net.ftp.FTPSClient;
|
||||
import org.dromara.hutool.core.io.IoUtil;
|
||||
import org.dromara.hutool.core.io.file.FileUtil;
|
||||
import org.dromara.hutool.core.lang.Console;
|
||||
import org.dromara.hutool.core.text.StrUtil;
|
||||
import org.dromara.hutool.extra.ssh.engine.jsch.JschSftp;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.List;
|
||||
|
||||
public class FtpTest {
|
||||
@@ -128,6 +131,18 @@ public class FtpTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void readTest() throws Exception {
|
||||
try (final CommonsFtp ftp = CommonsFtp.of("localhost");
|
||||
final BufferedReader reader = new BufferedReader(new InputStreamReader(ftp.read("d://test/read/", "test.txt")))) {
|
||||
String line;
|
||||
while (StrUtil.isNotBlank(line = reader.readLine())) {
|
||||
Console.log(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void existSftpTest() {
|
||||
|
Reference in New Issue
Block a user