阅读从一个txt文件中的数据,而无需下载呢? [英] Read data from a txt file without downloading it?

查看:101
本文介绍了阅读从一个txt文件中的数据,而无需下载呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想解析出文本文件中的信息,这种服务了:

I want to parse information out of the text file this serves up:

http://finance.yahoo.com/ D / quotes.txt S = GOOG + YHOO&放大器; F = sak2

有没有办法到应用程序中做没有先下载该文件?不知怎的,将正文的内容?

Is there a way to do it within an app without downloading the file first? Somehow stream the text content?

推荐答案

打开HTTP连接的URL(使用内置的HttpURLConnection类,或者使用像一个图书馆的commons-httpclient的),并读取从输入流的结果内容被传

Open a Http connection to the URL (using either the builtin HttpURLConnection or use a library like commons-httpclient), and read the results from the input stream as the contents are transferred.

这是不可能读取该文件,而不需要通过网络的文件的内容传送。不过,你不需要传输内容的的存储磁盘上的文件 - 你可以简单地从流中读取的文件,并没有坚持到磁盘

It is impossible to read the file without transferring the contents of the file over the network. However, you don't need to transfer the contents and store the file on disk - you can simply read the file from the stream and not persist it to disk.

这篇关于阅读从一个txt文件中的数据,而无需下载呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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