如何从FTP读取文件没有下载呢? [英] How to read files from FTP without download them?

查看:105
本文介绍了如何从FTP读取文件没有下载呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的索引文件的程序code,我需要访问的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客户端收集了所有这些字节,并将其写入到本地磁盘上的文件,但你可以ofcourse做出一些Java code,这并不做最后一部分,而不是你可以选择写字节内存,或分析他们,因为他们进来并丢弃其中的一些,等等。

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操作:

http://www.cs.colostate.edu/helpdocs/ftp.html

和Java我的基础知识/ O第一:

and the basics of Java I/O first:

http://download.oracle.com/javase/tutorial/essential/io /

这篇关于如何从FTP读取文件没有下载呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆