private void iterateExistingExceptRemoved ( ZipEntryOrInfoAdapter zipEntryCallback ) { if ( src == null ) { // if we don't have source specified, then we have nothing to iterate. return ; } final Set < String > removedDirs = ZipUtil . filterDirEntries ( src , removedEntries ) ; ZipFile zf = null ; try { zf = getZipFile ( ) ; // manage existing entries Enumeration < ? extends ZipEntry > en = zf . entries ( ) ; while ( en . hasMoreElements ( ) ) { ZipEntry entry = en . nextElement ( ) ; String entryName = entry . getName ( ) ; if ( removedEntries . contains ( entryName ) || isEntryInDir ( removedDirs , entryName ) ) { // removed entries are continue ; } if ( nameMapper != null ) { String mappedName = nameMapper . map ( entry . getName ( ) ) ; if ( mappedName == null ) { continue ; // we should ignore this entry } else if ( ! mappedName . equals ( entry . getName ( ) ) ) { // if name is different, do nothing entry = ZipEntryUtil . copy ( entry , mappedName ) ; } } InputStream is = zf . getInputStream ( entry ) ; try { zipEntryCallback . process ( is , entry ) ; } catch ( ZipBreakException ex ) { break ; } finally { IOUtils . closeQuietly ( is ) ; } } } catch ( IOException e ) { ZipExceptionUtil . rethrow ( e ) ; } finally { ZipUtil . closeQuietly ( zf ) ; } }
Iterate through source for not removed entries with a given callback