设置下载文件路径 & 获取接口结尾名称。

// 获取下载位置

private String isExistDir(String saveDir) throws IOException {

          

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

 

 

            if (!downloadFile.mkdirs()) {

                downloadFile.createNewFile();

            }

            String savePath = downloadFile.getAbsolutePath();

   

            return savePath;

}

 

 

//获取接口地址结尾名称

 private String getNameFromUrl(String url) {

 

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

        }

 

 

posted @ 2018-12-06 14:30  dber521  阅读(330)  评论(0编辑  收藏  举报