// Initiate ZipFile object with the path/name of the zip file.
ZipFile zipFile = new ZipFile("c:\\ZipTest\\CreateSplitZipFileFromFolder.zip");
// Initiate Zip Parameters which define various properties such
// as compression method, etc.
ZipParameters parameters = new ZipParameters();
// set compression method to store compression
parameters.setCompressionMethod(Zip4jConstants.COMP_DEFLATE);
// Set the compression level. This value has to be in between 0 to 9
parameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_NORMAL);
// Create a split file by setting splitArchive parameter to true
// and specifying the splitLength. SplitLenth has to be greater than
// 65536 bytes
// Please note: If the zip file already exists, then this method throws an
// exception
zipFile.createZipFileFromFolder("C:\\ZipTest", parameters, true, 10485760);
我从使用 zip4j 的示例代码中复制了这个,特别是名为CreateSplitZipFileFromFolder.java
问题是,即使我将 的第三个参数设置为 true createZipFileFromFolder
,当我调用该方法时它仍然会返回 falseZipFile.isSplitArchive()
从 grepcode 看来,它只是将ZipModel
对象设置为我设置的布尔标志,但我得到了不同的值。任何想法为什么会这样?