简体   繁体   中英

Transform object inputstream to object file

How to transform object inputstream to object file.

I have code as below:

AssetManager assetManager = context.getAssets();
InputStream myInputSttream = assetManager.open("file.zip");
File myFile = new File("/path/location/file.zip");

Because I have file from asset manager which the object is inputstream, but I want to use this file as object File for the purposes of algorithm code below.

Since you are looking to unzip files from the InputStream into files onto the SDCard (per your comment), You should look at ZipInputStream . You will write something like this

ZipInputStream zis = new ZipInputStream(assetManager.open("file.zip"));

you can then use this code sample as a guide to actually output the contents of the zip file into the SD Card

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM