On a Unix/Linux box you could just run 'wget' but this is not really an option if you're writing a cross-platform client. Of course this assumes that you don't really want to do much with the data you download between the point of downloading it and it hitting the disk.
String html = Jsoup.connect("http://stackoverflow.com").get().html();
It handles GZIP and chunked responses and character encoding fully transparently. It offers more advantages as well, like HTML 穿越 and manipulation by CSS selectors like as jQuery can do. You only have to grab it as Document, not as a String.
上面提到的所有方法都不会像在浏览器中那样下载网页文本。现在很多数据都是通过 html 页面中的脚本加载到浏览器中的。上面提到的技术都不支持脚本,它们只是下载 html 文本。HTMLUNIT 支持 javascript。因此,如果你正在寻找下载的网页文本,因为它看起来在浏览器然后你应该使用 HTMLUNIT。