问题描述
在我的索引文件程序代码中,我需要访问 FTP 文件并阅读所有文件而不下载它们,我如何使用 org.apache.commons.net 库来做到这一点?
In my index file program code i need to access to FTP files and read all of them without download them,how can i do that with org.apache.commons.net library?
推荐答案
我不太清楚你所说的下载"是什么意思.为了通过 FTP 获取某些内容,您必须发出 FTP GET 命令,该命令将打开一个流向您的客户端并开始通过该流发送请求文件的字节.现在大多数 FTP 客户端收集所有这些字节并将它们写入本地磁盘上的文件,但是您当然可以编写一些不执行最后一部分的 Java 代码,相反您可以选择将字节写入内存或解析它们当他们进来并丢弃其中的一些,等等.
Well I'm not really sure what you mean by "download". In order to get something via FTP you must issue the FTP GET command which will open a stream towards your client and start sending the bytes of the requested file via that stream. Now most FTP clients gather up all those bytes and write them to a file on the local disk, but you can ofcourse make some Java code that does not do that last part, instead you may choose to write the bytes in memory, or parse them as they come in and discard some of them, etc.
是的,我确实意识到我并没有向您提供有关如何使用 Apache 的公共网络库来做到这一点的重点说明,因为我认为您应该首先了解您正在尝试做的事情的基础知识在你冒险使用一个在这一切之上进行抽象的库之前.
And yes, I do realise that I'm not giving you to the point instructions on how to use Apache's commons net library to do that, because I believe that you should first understand the basics of what you're trying to do before you venture into using a library that makes an abstraction on top of it all.
查看基本的 FTP 操作:
Look up the basic FTP operations:
http://www.cs.colostate.edu/helpdocs/ftp.html
首先是 Java I/O 的基础知识:
and the basics of Java I/O first:
http://download.oracle.com/javase/tutorial/essential/io/
这篇关于如何在不下载的情况下从 FTP 读取文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)