Java URL getContent() 方法

2025年3月24日 | 1 分钟阅读

URL 的 getContent() 方法获取该 URL 的内容。此方法是 openConnection().getContent() 的简写。

语法

返回值

该 URL 的内容。

Throw

IOException - 如果发生 I/O 异常。

示例 1

输出

Given Url is : https://tpointtech.cn/
The content of given url is: sun.net.www.protocol.http.HttpURLConnection$HttpInputStream@feb3fa

示例 2

输出

sun.net.www.protocol.http.HttpURLConnection$HttpInputStream
The mime type is : text/html; charset=iso-8859-1
下一个主题Java URL 类