zip4j icon indicating copy to clipboard operation
zip4j copied to clipboard

split zip files can not extract single file correctly

Open lzxshare opened this issue 3 years ago • 0 comments
trafficstars

because i have many files,i split the zip file,like this:

ZipParameters zipParameters = new ZipParameters();
zipParameters.setEncryptFiles(true);
zipParameters.setCompressionLevel(CompressionLevel.FAST);
zipParameters.setIncludeRootFolder(false);
zipParameters.setSymbolicLinkAction(ZipParameters.SymbolicLinkAction.INCLUDE_LINK_AND_LINKED_FILE);
zipParameters.setEncryptionMethod(EncryptionMethod.ZIP_STANDARD);  

ZipFile zipFile = new ZipFile(packOutputFile, keyword.toCharArray());
zipFile.setRunInThread(true);
zipFile.createSplitZipFile(backFileList, defaultZipParameters, true, SPLIT_SIZE);

some files has the same file name,but from different path:

A/B/C/fileName.txt
A/F/G/fileName.txt
A/B/C/P/fileName.txt
E/B/C/fileName.txt
....

i want to extract single file,like A/B/C/P/fileName.txt,and i use this api code:

FileHeader fileHeader = zipFile.getFileHeader("fileName.txt"); zipFile.extractFile(fileHeader, parentFile.getAbsolutePath(), mergeName);

but i got a not correct file.i also use the full path to get FileHeader:

FileHeader fileHeader = zipFile.getFileHeader("A/B/C/P/fileName.tx"); zipFile.extractFile(fileHeader, parentFile.getAbsolutePath(), mergeName);

but they returns null,i also debug the source code,and i found Zip FileHeader only show file names,debug info like this:

image

note: the parameters passed "backFileList" all is the files, not contains folder

and here is output zip file,the encryption password is 111111,you can input password to unzip the test file.

could you give me some helpful ideas?this question has puzzled me for a long time, and i want to solve it as soon as possible. thank you very much.

1658803896900.zip

lzxshare avatar Jul 27 '22 09:07 lzxshare