Android读取asset目录的文件转File
2016-12-16 16:00
1106 查看
直接调用writeBytesToFile:
writeBytesToFile(getActivity().getAssets().open("xxx文件名"),file);
public static void writeBytesToFile(InputStream is, File file) throws IOException{ FileOutputStream fos = null; try { byte[] data = new byte[2048]; int nbread = 0; fos = new FileOutputStream(file); while((nbread=is.read(data))>-1){ fos.write(data,0,nbread); } } catch (Exception ex) { logger.error("Exception",ex); } finally{ if (fos!=null){ fos.close(); } } }
相关文章推荐
- 关于Android/IOS里边读取StreamingAsset目录 文件流
- android 中读取asset目录中文件并写入SD卡以及从SD卡中读取的简介
- android文件的写入与读取---简单的文本读写context.openFileInput() context.openFileOutput()
- Android MTK烧目录文件(里面存放Downloader需要file)
- android 读取assets目录中的配置文件信息
- 【Android 开发】:数据存储之File文件存储 [即SD卡的写入与读取]
- android应用私有存储文件的写入与读取-openFileInput 和 openFileOutput
- Android如何获取asset目录下所有文件的路径
- Android读取assets目录下文件数据内容
- Android读取assets目录下文件数据内容
- Android从文件目录中写入和读取图片
- Android读取assets目录下文件
- Android开发笔记(二十五)assets目录下的文件读取
- Android 读取目录中的文件列表并展示
- android JNI使用AAssetManager读取asset目录内容
- Android中读取asset路径下本地json文件
- Android File Transfer – 在 Mac 上也能读取 Android 设备文件
- Android 读取手机某个文件夹目录及子文件夹中所有的txt文件
- android文件的写入与读取---简单的文本读写context.openFileInput() context.openFileOutput()
- 如何访问android的asset目录和res目录下的文件