在创建文件输出流时 一定得保证 文件夹! 文件夹! 文件夹! 存在。
即在 new FileOutputStream(file);之前 先调用 mkdirs()方法:
创建代码如下:
File foder = new File(FileUtils.getRootDirectory()+ "/updateVersion/"); if (!foder.exists()) { foder.mkdirs(); } String path= foder.getPath()+文件名.xxx; FileOutputStream fos = new FileOutputStream(new File(path)); 剩下的 就是讲文件流 write 成文件了 ;