Android编程实现将压缩数据库文件拷贝到安装目录的方法
作者:freesonhp 发布时间:2022-06-18 16:06:56
标签:Android,压缩,拷贝
本文实例讲述了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程序设计有所帮助。
0
投稿
猜你喜欢
- 本文实例为大家分享了Unity3D仿写Button面板事件绑定功能的具体代码,供大家参考,具体内容如下最近在做一个情节引导得项目。其中一个需
- 本人是从事互联网金融行业的,所以会接触到一些金融类的问题,常见的一种就是数字转汉字大小写的问题。所以抽空就写了一个小小的工具类,实现了数字转
- 1、接口:一种把类抽象的更彻底,接口里只能包含抽象方法的“特殊类”。接口不关心类的内部状态数据,定义的是一批类所遵守的规范。(它只规定这批类
- 在Android studio实现简易计算器App并实现加减乘除功能,供大家参考,具体内容如下结果activity_main.xml<
- 一、基于框架1.IDEIntelliJ IDEA2.软件环境Spring bootmysqlmybatisorg.apache.poi二、环
- Android 列表选择框 Spinner详解及实例Spinner 是 Android 的列表选择框,不过 spinner 并不需要显示下拉
- 前言最近在学习网络原理,突然萌发出自己实现一个网络服务器的想法,并且由于第三代小白机器人的开发需要,我把之前使用python、PHP写的那部
- java文件输出流是一种用于处理原始二进制数据的字节流类。为了将数据写入到文件中,必须将数据转换为字节,并保存到文件。package com
- 1.SpringBoot AOP功能1.1 LTW与不同的切面织入时机AOP——面向切面编程,通过为
- Handler每个初学Android开发的都绕不开Handler这个“坎”,为什么说是个坎呢,首先这是Android架构的精髓之一,其次大部
- 本文实例讲述了C#中winform控制textbox输入只能为数字的方法。分享给大家供大家参考。具体实现方法如下:添加keyPress事件,
- 本文实例讲述了Java Socket使用加密协议进行传输对象的方法。分享给大家供大家参考,具体如下:前面的几篇文章介绍了Socket中一些常
- 最近一直都在学习Java,发现目前Java招聘中,mybatis出现的频率挺高的,可能是目前Java开发中使用比较多的数据库ORM框架。于是
- 简述每个项目从新建开始我们或多或少都会导入各种依赖库,如果项目中只有一个module的话,对于依赖库版本的管理很容易,但是多个module的
- springBoot集成Elasticsearch 报错 Health check failed今天集成Elasticsearch 时启动报
- 一、字符串:1、访问String中的字符:string本身可看作一个Char数组。string s = "hello world&
- 起因我们先来看一个报错报错很简单,参数 start 没找到。我是在实现一个 API 接口时发现了一个问题,当我不使用 @Param 标签时,
- 这篇文章主要介绍了Spring @Transactional注解失效解决方案,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的
- 前文传送门:ByteBuf使用subPage级别内存分配ByteBuf回收之前的章节我们提到过, 堆外内存是不受jvm垃圾回收机制控制的,
- 编程中经常有用到MD5加密的情况,Java语言并没有像PHP一样提供原生的MD5加密字符串的函数,需要MD5加密的时候,往往需要自己写。代码