I need to provide a view of zip file to customer in system, and allow customers download choosed files.
- parse the zip file and show on the web page. and remember every zipentry location(for example file1 is starting from byte 100 width length 1024bytes) in backend.
- download the specified file when customer click the download button.
now I have rememberred all zipentry locations, but is there java zip tools to unzip the specified location of zip files?? API just like unzip(file, long entryStart, long entryLength);
You can use the below code to extract a particular file from zip:-
Also refer this link: How to extract a single file from a remote archive file?
You can try like this:
I havent tried it but in Java 7 ZipFileSystem you can try like this to extract file.TXT file from the zip file.
This can be done without messing with byte arrays or input streams using Java 7's NIO2: