Java example of reading web page content

Java example of reading web page content

The above code program reads the source code of a web page, including HTML and XML, into a string string a of Java.

The string type in Java has a large space, which can basically accommodate the content of a web page source code.

Reading content from a web page is also an operation on the input stream.

Different from the standard input source, in:

Enter system. In inputstreamreader Just in.

The input source here should be:

The subsequent operations and processing are exactly the same as loading the standard input source.

BufferedReader requires that IOException exceptions must be caught in Java, and the use of URL source must introduce Java net.* In addition to the package, malformedurlexception exceptions must also be caught.

If you have any questions, please leave a message or go to the community of this site for exchange and discussion. Thank you for reading. I hope it can help you. Thank you for your support to this site!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>