Android編程實(shí)現(xiàn)將壓縮數(shù)據(jù)庫(kù)文件拷貝到安裝目錄的方法
更新時(shí)間:2015年10月23日 14:21:41 作者:freesonhp
這篇文章主要介紹了Android編程實(shí)現(xiàn)將壓縮數(shù)據(jù)庫(kù)文件拷貝到安裝目錄的方法,涉及Android處理壓縮文件的相關(guān)技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下
本文實(shí)例講述了Android編程實(shí)現(xiàn)將壓縮數(shù)據(jù)庫(kù)文件拷貝到安裝目錄的方法。分享給大家供大家參考,具體如下:
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(); }
希望本文所述對(duì)大家Android程序設(shè)計(jì)有所幫助。
相關(guān)文章
Android ZxingPlus精簡(jiǎn)的二維碼框架示例代碼
下面小編就為大家分享一篇Android ZxingPlus精簡(jiǎn)的二維碼框架示例代碼,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2018-01-01kotlin實(shí)現(xiàn)語音聊天機(jī)器人案例詳解
Android智能問答機(jī)器人是時(shí)下非常流行的一種服務(wù),微軟“小冰”的出現(xiàn)更是讓其實(shí)實(shí)在在的風(fēng)靡了一把。那么,本文章就將帶領(lǐng)大家完整的實(shí)現(xiàn)整個(gè)問答機(jī)器人的制作2023-02-02android判斷應(yīng)用是否已經(jīng)啟動(dòng)的實(shí)例
這篇文章主要介紹了android判斷應(yīng)用是否已經(jīng)啟動(dòng)的實(shí)例,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2020-03-03