public class HttpDemo {

    public static void main(String[] args) {
            
        // 拼接url https://www.songzixian.com:8080/aaa/bbb?ie=UTF-8&wd=test
        String url = UrlBuilder.create()
                .setScheme("https")
                .setHost("www.hutool.cn")
                .setPort(8080)
                .addPath("/aaa").addPath("bbb")
                .addQuery("ie", "UTF-8")
                .addQuery("wd", "test")
                .build();
                
        // 下载保存到本地"D:\\tmp\\centre.xlsx
        long file = HttpUtil.downloadFile(url, "D:\\tmp\\centre.xlsx");

    }
}
Last modification:August 1, 2022
如果觉得这篇技术文章对你有用,请随意赞赏