- import net.lingala.zip4j.ZipFile;
- import net.lingala.zip4j.exception.ZipException;
- import net.lingala.zip4j.model.FileHeader;
- import java.io.IOException;
-
- public class SampleClass{
-
- public static void main(String[] args)
- throws ZipException,
- IOException{
- ZipFile zip = null;
-
- try{
- zip = new ZipFile
- ("myzip.zip");
- FileHeader header =
- zip.getFileHeader("img.jpg");
-
- if(header != null){
- zip.removeFile(header);
- System.out.println("\"img.jpg\""+
- " has been removed.");
- }
- }
- finally{
- if(zip != null)
- zip.close();
- }
-
- }
- }