我如何读取Http请求的文档?,我正在搜索一种简单的方法,最简单的是我的想法。
URL url = new URL("http://www.y.com/url");
InputStream is = url.openStream();
try {
/* Now read the retrieved document from the stream. */
...
} finally {
is.close();
}
但是我该如何阅读或在控制台中打印?如果有更简单的方法来执行http请求并阅读响应正文,请在注释中帮助我,这是我第一次使用java,因此“ http url connection”我什么都不懂