从assets中拷贝from文件到指定目录下
2015-05-19 09:35
351 查看
/** * * 从assets中拷贝from文件到to目录下 * **/ public void copyFile(Context context, String sourPath, String toPath) { OutputStream output = null; InputStream input = null; try { int read = 0; input = context.getResources().getAssets().open(sourPath); output = new BufferedOutputStream(new FileOutputStream(toPath)); byte[] buf = new byte[2048]; while ((read = input.read(buf)) != -1) { output.write(buf, 0, read); } } catch (Exception e) { Write.error(e.getMessage()); } finally { try { if(output !=null){ output.close(); } if(input!=null){ input.close(); } } catch (IOException e) { Write.debug(""+e.getMessage()); } } }
相关文章推荐
- Android 拷贝assets目录下所有文件及文件夹到指定路径
- Android从Assets拷贝文件以及文件夹到指定目录
- Android从Assets拷贝文件以及文件夹到指定目录
- 用java写了一个实用的类----递归的拷贝给定目录的.java文件到指定的一个文件中
- Android复制Assets目录下的文件到指定目录
- 拷贝一个目录或者文件到指定路径下
- shell 递归函数---循环拷贝文件到指定目录
- gulp监听文件变化,并拷贝到指定目录
- assets目录下的文件拷贝到sd卡目录下
- linux下使用cp拷贝指定文件或目录
- 把assets目录下的db文件拷贝进来
- python实现拷贝指定文件到指定目录
- 对指定目录下的文件进行筛选,并重命名拷贝到另一个目录
- 字节流拷贝指定的文件及目录
- 拷贝文件到指定目录
- gulp监听文件变化,并拷贝到指定目录
- vs生成的文件如何自动拷贝到指定目录
- 将多级目录的文件拷贝到一个指定目录
- C#Winfrom获取指定目录下所有文件名称和文件名称相应的目录 并且添加到DataTable
- 黑马程序员—编写程序,将指定目录下所有.java文件拷贝到另一个目的中,并将扩展名改为.txt