- import net.lingala.zip4j.ZipFile;
- import net.lingala.zip4j.exception.ZipException;
- import net.lingala.zip4j.model.ZipParameters;
- import java.io.File;
- import java.io.IOException;
- import java.util.List;
- import java.util.Arrays;
-
- public class SampleClass{
-
- public static void main(String[] args)
- throws ZipException,
- IOException{
- ZipFile zip = null;
-
- try{
- zip = new ZipFile("myzip.zip");
- List<File> filesToAdd =
- Arrays.asList(
- new File("img1.jpg"),
- new File("img2.jpg"),
- new File("img3.jpg"),
- new File("img4.jpg"));
-
- zip.createSplitZipFile
- (filesToAdd,
- new ZipParameters(),
- true,
- 81920);
- }
- finally{
- if(zip != null)
- zip.close();
- }
-
- System.out.println
- ("main thread end");
- }
- }