private void checkIndex() throws IOException {
  boolean isUpToDate=true;
  if (!isUpToDate()) {
    closeFile();
    isUpToDate=false;
  }
  if (zipRandomFile != null || isUpToDate) {
    lastReferenceTimeStamp=System.currentTimeMillis();
    return;
  }
  hasPopulatedData=true;
  if (readIndex()) {
    lastReferenceTimeStamp=System.currentTimeMillis();
    return;
  }
  directories=Collections.<RelativeDirectory,DirectoryEntry>emptyMap();
  allDirs=Collections.<RelativeDirectory>emptySet();
  try {
    openFile();
    long totalLength=zipRandomFile.length();
    ZipDirectory directory=new ZipDirectory(zipRandomFile,0L,totalLength,this);
    directory.buildIndex();
  }
  finally {
    if (zipRandomFile != null) {
      closeFile();
    }
  }
  lastReferenceTimeStamp=System.currentTimeMillis();
}

private void checkIndex ( ) throws IOException { boolean isUpToDate = true ; if ( ! isUpToDate ( ) ) { closeFile ( ) ; isUpToDate = false ; } if ( zipRandomFile != null || isUpToDate ) { lastReferenceTimeStamp = System . currentTimeMillis ( ) ; return ; } hasPopulatedData = true ; if ( readIndex ( ) ) { lastReferenceTimeStamp = System . currentTimeMillis ( ) ; return ; } directories = Collections . < RelativeDirectory , DirectoryEntry > emptyMap ( ) ; allDirs = Collections . < RelativeDirectory > emptySet ( ) ; try { openFile ( ) ; long totalLength = zipRandomFile . length ( ) ; ZipDirectory directory = new ZipDirectory ( zipRandomFile , 0L , totalLength , this ) ; directory . buildIndex ( ) ; } finally { if ( zipRandomFile != null ) { closeFile ( ) ; } } lastReferenceTimeStamp = System . currentTimeMillis ( ) ; }
here we need to make sure that the zipfileindex is valid . check the timestamp of the file and if its the same as the one at the time the index was build we don ' t need to reopen anything .
