Using InputStream to extract files, which I don't know whether they are password protected or not beforehand, doesn't allow to check for encryption before extraction.
Right now you need to call setPassword or provide password via constructor before calling getNextEntry() which is not always possible. On the other hand calling headerReader.readLocalFileHeader() to obtain LocalFileHeader is possible without password and there isEncrypted() can be checked.
Unfortunately getNextEntry() doesn't execute some "password callback" in case this is detected but tries to extract right away after obtaining LocalFileHeader.
Calling headerReader.readLocalFileHeader() first and then getNextEntry() causes skipping of files because headerReader.readLocalFileHeader() moves the position in the stream of course.
To solve this please provide something like "password callback" setter which will be executed if no password was provided and file is encrypted.
Using
InputStreamto extract files, which I don't know whether they are password protected or not beforehand, doesn't allow to check for encryption before extraction.Right now you need to call
setPasswordor provide password via constructor before callinggetNextEntry()which is not always possible. On the other hand callingheaderReader.readLocalFileHeader()to obtainLocalFileHeaderis possible without password and thereisEncrypted()can be checked.Unfortunately
getNextEntry()doesn't execute some "password callback" in case this is detected but tries to extract right away after obtainingLocalFileHeader.Calling
headerReader.readLocalFileHeader()first and thengetNextEntry()causes skipping of files becauseheaderReader.readLocalFileHeader()moves the position in the stream of course.To solve this please provide something like "password callback" setter which will be executed if no password was provided and file is encrypted.