简体   繁体   English

使用 HTTPClient 下载数据

[英]Download Data Using HTTPClient

Had a question about using Apache HTTPClient.有一个关于使用 Apache HTTPClient 的问题。 I need to pull data from a website and found this useful tutorial https://hc.apache.org/httpclient-3.x/tutorial.html我需要从网站上提取数据并找到了这个有用的教程https://hc.apache.org/httpclient-3.x/tutorial.html

In the tutorial it says we will write a simple application that "downloads a page".在教程中,它说我们将编写一个“下载页面”的简单应用程序。

Where exactly does it "download" the page to?它究竟将页面“下载”到哪里? I am not seeing mention of a database being set up so or some cloud storage or whatnot so where does the information "go" exactly (or where is it being held once the data is pulled)?我没有看到提到正在设置的数据库,或者一些云存储或诸如此类的信息,那么信息究竟“去”哪里(或者一旦数据被拉出它被保存在哪里)? I'm somewhat new to Java so this is a bit conceptual我对 Java 有点陌生,所以这有点概念性

The "download" goes to System.out : “下载”转到System.out

  // Read the response body.
  byte[] responseBody = method.getResponseBody();

  // Deal with the response.
  // Use caution: ensure correct character encoding and is not binary data
  System.out.println(new String(responseBody));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM