[英]Java jsch and remote file transfer
I'm using Jsch
to transfer an html file from a remote server to my local system, which I plan on showing in an SWT
browser. 我正在使用
Jsch
将html文件从远程服务器传输到我的本地系统,我计划在SWT
浏览器中显示该文件。 com.jcraft.jsch.ChannelSftp
provides a getter method that returns an InputStream
. com.jcraft.jsch.ChannelSftp
提供了一种getter方法,该方法返回InputStream
。 I'm wondering if theres a way to translate that InputStream
into a URL
without writing the file contents out to disk. 我想知道是否有一种方法可以在不将文件内容写到磁盘的情况下将
InputStream
转换为URL
。
You can create a custom Protocol Handler , and then (in theory) anything that takes a URL object should be able to use the custom protocol to retrieve data. 您可以创建一个自定义协议处理程序 ,然后(理论上)使用URL对象的任何东西都应该能够使用该自定义协议来检索数据。 The protocol handler would then just encapsulate the JCraft code.
然后,协议处理程序将只封装JCraft代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.