Android编程实现将压缩数据库文件拷贝到安装目录的方法
作者:freesonhp 时间:2022-06-18 16:06:56
本文实例讲述了Android编程实现将压缩数据库文件拷贝到安装目录的方法。分享给大家供大家参考,具体如下:
public void copyZip2DataDirectory(Context context) throws IOException {
FileOutputStream outputStream = null;
AssetManager assetManager = context.getAssets();
InputStream inputStream = assetManager.open("test.zip");
ZipInputStream zis = new ZipInputStream(inputStream);
ZipEntry entry = null;
while ((entry = zis.getNextEntry()) != null) {
outputStream = context.openFileOutput(entry.getName(), Context.MODE_PRIVATE);
byte[] buffer = new byte[2 * 1024];
int len = -1;
while ((len = zis.read(buffer)) != -1) {
outputStream.write(buffer, 0, len);
}
outputStream.close();
}
zis.close();
inputStream.close();
}
希望本文所述对大家Android程序设计有所帮助。
标签:Android,压缩,拷贝
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Java如何设置PDF文档背景色详解
2022-07-08 08:17:19
![](https://img.aspxhome.com/file/2023/7/77947_0s.png)
C#实现读取txt文件生成Word文档
2022-08-06 19:03:22
![](https://img.aspxhome.com/file/2023/5/98215_0s.jpg)
Java设计者模式简单工厂模式解析
2023-02-07 14:02:54
![](https://img.aspxhome.com/file/2023/5/97805_0s.png)
Android横竖屏幕切换生命周期详解
2023-11-02 03:29:45
![](https://img.aspxhome.com/file/2023/5/104645_0s.jpg)
关于MyBatis中SqlSessionFactory和SqlSession简解
2022-02-18 13:57:37
C# 站点IP访问频率限制 针对单个站点的实现方法
2023-09-23 18:35:30
MyBatis的注解使用、ORM层优化方式(懒加载和缓存)
2023-04-24 09:16:13
![](https://img.aspxhome.com/file/2023/8/86048_0s.jpg)
Android Compose Column列表不自动刷新问题
2022-08-10 07:48:02
![](https://img.aspxhome.com/file/2023/2/96762_0s.gif)
浅谈Java多进程程序的运行模式
2021-07-06 11:06:49
Spring与Spring boot的区别介绍
2022-02-12 08:55:07
C#使用Clipboard类实现剪贴板功能
2022-09-29 06:03:54
MyBatis 中 SqlMapConfig 配置文件详解
2023-10-19 21:23:01
java实现简单的扫雷小游戏
2022-09-14 19:23:24
![](https://img.aspxhome.com/file/2023/3/95953_0s.jpg)
Android 虚拟按键适配动态调整布局的方法
2022-03-03 07:20:24
![](https://img.aspxhome.com/file/2023/5/90135_0s.jpg)
重新认识Java的System.in
2023-08-24 01:55:18
springboot连接不上redis的三种解决办法
2022-03-21 20:57:23
![](https://img.aspxhome.com/file/2023/3/67093_0s.png)
android点击无效验证的解决方法
2022-02-28 03:55:08
![](https://img.aspxhome.com/file/2023/2/109212_0s.png)
Java多线程ThreadAPI详细介绍
2023-04-14 12:19:18
![](https://img.aspxhome.com/file/2023/8/68208_0s.png)
Java中JSR303的基本使用详情
2021-07-29 01:01:12
![](https://img.aspxhome.com/file/2023/9/94359_0s.png)
整理总结Java多线程程序编写的要点
2022-02-19 16:17:23
![](https://img.aspxhome.com/file/2023/5/103975_0s.jpg)