zip4j
zip4j copied to clipboard
split zip files can not extract single file correctly
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:

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.