JAVA如何后台使用URL返回一个文件流,将文件流转成文件存到本地?

问题
  我使用图中的地址是直接浏览器下载文件,我想用这个地址在后台下载出来到我本地给任务调度使用

img

运行结果
最后转的成了一种xml格式的,如图:

img

我的做法
java
     * @param conn
     * @throws IOException
     */
    private static void downloadFileFromZipStream(HttpURLConnection conn) throws IOException {
        BufferedInputStream bis = null;
        ZipInputStream zin = null;
        int len;
        byte[] buf = new byte[1024];
        //注意创建文件夹问题,我这没有创建,自己手动再本地创建好文件夹
        FileOutputStream fos = new FileOutputStream("D:\\订单流水表.xlsx");
        try {
            //获取网络输入流
            bis = new BufferedInputStream(conn.getInputStream());
            zin = new ZipInputStream(bis);
            while ((zin.getNextEntry()) != null) {
                while ((len = zin.read(buf)) != -1) {
                    fos.write(buf, 0, len);
                }
            }
            // 关流顺序,先打开的后关闭
            return ;
        } catch (Exception e) {

        } finally {
            if (bis != null) {
                bis.close();
            }
            if (zin != null) {
                zin.close();
            }
            fos.close();
        }
        return ;
    }


    public static void main(String[] args) throws IOException {

        String urlString="http://localhost:8075/webroot/decision/view/report?viewlet=WorkBook4.cpt&format=excel&extype=simple";
        URL url = new URL(urlString);
        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
       downloadFileFromZipStream(connection);
    }
我想要达到的结果

因为我这个表格有样式之类的所以想我这个xml格式是不是能有什么方法转成文件下载的本身格式一个正常的表格
其次是除了这样还有其他方法没有
主要做报表对这个开发这一块不是很熟悉,恳求指点 .

有轮子 commons-io 包里有个FileUtils

<dependency>
    <groupId>commons-io</groupId>
    <artifactId>commons-io</artifactId>
    <version>2.7</version>
</dependency>
// 传个url,再传个要保存的文件的file对象就行啦
FileUtils.copyURLToFile(URL source, File destination)