JAVA网络编程URL类

import org.apache.commons.io.IOUtils;

import java.io.InputStream;
import java.net.URL;

public class URLDemo {
    public static void main(String[] args) throws Exception {
        URL url = new URL("http","www.baidu.com", 80, "/");
        InputStream inputStream = url.openStream();
        System.out.println(IOUtils.toString(inputStream, "utf-8"));
    }
}
上一篇:看到Mybatis源码就感到烦躁,怎么办?


下一篇:idea环境下-使用java下载网页-爬取网页