1. import net.lingala.zip4j.ZipFile;
  2. import net.lingala.zip4j.exception.ZipException;
  3. import net.lingala.zip4j.model.ZipParameters;
  4. import java.io.File;
  5. import java.io.IOException;
  6. import java.util.List;
  7. import java.util.Arrays;
  8. public class SampleClass{
  9. public static void main(String[] args)
  10. throws ZipException,
  11. IOException{
  12. ZipFile zip = null;
  13. try{
  14. zip = new ZipFile("myzip.zip");
  15. List<File> filesToAdd =
  16. Arrays.asList(
  17. new File("img1.jpg"),
  18. new File("img2.jpg"),
  19. new File("img3.jpg"),
  20. new File("img4.jpg"));
  21. zip.createSplitZipFile
  22. (filesToAdd,
  23. new ZipParameters(),
  24. true,
  25. 81920);
  26. }
  27. finally{
  28. if(zip != null)
  29. zip.close();
  30. }
  31. System.out.println
  32. ("main thread end");
  33. }
  34. }