ZipEntry to File

Use ZipFile class

    ZipFile zf = new ZipFile("zipfile");

Get entry

    ZipEntry e = zf.getEntry("name");

Get inpustream

    InputStream is = zf.getInputStream(e);

Save bytes

    Files.copy(is, Paths.get("C:\\temp\\myfile.java"));

Use ZipInputStream to move to the desired ZipEntry by iterating using the getNextEntry() method. Then use the ZipInputStream.read(...) method to read the bytes for the current ZipEntry. Output those bytes to a FileOutputStream pointing to a file of your choice.

Tags:

Java

File

Zip