I'd like to apply zip4j in my android app. I put a demo zip file into the assets folder (main/assets/test.zip
). I'd like to open it with zip4j:
import net.lingala.zip4j.core.ZipFile;
...
ZipFile zipFile = new ZipFile(new File("an/absolute/path/is/required"));
However, the constructor required for applying zip4j requires a String
object (the absolute path of the file) or a File
object. But the AssetManger of Android only returns an InputStream
. Also please not: The AssetManger does not provide an absolute path or something.
So, what do I have to do in order to transform the input stream of InputStream is = getResources().getAssets().open(filename);
into a java.io.File
object which I then can apply to ZipFile