Akka Alpakka Ftp库是否支持从URL获取文件?
我正在使用这个库作为Ftp客户端。我将文件的url作为路径。但正如我从代码实现中看到的,它们只支持函数中的java.nio.file.PathAkka Alpakka Ftp库是否支持从URL获取文件?,ftp,akka,akka-stream,java.nio.file,Ftp,Akka,Akka Stream,Java.nio.file,我正在使用这个库作为Ftp客户端。我将文件的url作为路径。但正如我从代码实现中看到的,它们只支持函数中的java.nio.file.Path val ftpSettings = FtpSettings(host, port, NonAnonFtpCredentials(userName, pass), passiveMode = true) Ftp.fromPath("Path object", ftpSettings) 但我没有本地文件。我只有该文件的url。是否有可能通过url获取文件
val ftpSettings = FtpSettings(host, port, NonAnonFtpCredentials(userName, pass), passiveMode = true)
Ftp.fromPath("Path object", ftpSettings)
但我没有本地文件。我只有该文件的url。是否有可能通过url获取文件 还有两个
fromPath
重载,允许指定主机和凭据
def fromPath(
host: String,
path: Path
)(implicit ftpLike: FtpLike[FtpClient]): Source[ByteString, Future[IOResult]]
def fromPath(
host: String,
username: String,
password: String,
path: Path
)(implicit ftpLike: FtpLike[FtpClient]): Source[ByteString, Future[IOResult]]
最后,我找到了path与url的用法。与其使用整个url,不如使用文件的路径
Ftp.fromPath(Paths.get("/directory/fileName.txt"), ftpSettings)
我已经在使用这个设置了。val ftpSettings=ftpSettings(主机、端口、非TPCredentials(用户名、密码))这两个函数都等待路径参数。