設置下載文件路徑 & 獲取接口結尾名稱。

// 獲取下載位置 url

private String isExistDir(String saveDir) throws IOException {spa

          

            File downloadFile = new File("/Users/dongbo/Downloads");接口

 

 

            if (!downloadFile.mkdirs()) {get

                downloadFile.createNewFile();string

            }it

            String savePath = downloadFile.getAbsolutePath();io

   

            return savePath;ast

}class

 

 

//獲取接口地址結尾名稱下載

 private String getNameFromUrl(String url) {

 

            return url.substring(url.lastIndexOf("/") + 1);

        }

相關文章
相關標籤/搜索