Impl(File directory) throws IOException {
  boolean exists=directory.exists();
  if (exists && !directory.isDirectory()) {
    throw new IOException(directory + " exists but is not a directory.");
  }
  if (exists) {
    initialFiles=directory.list();
    if (initialFiles == null) {
      throw new IOException(directory + " exists but cannot list contents.");
    }
    Arrays.sort(initialFiles);
    size=initialFiles.length;
  }
 else {
    if (!directory.mkdirs()) {
      throw new IOException("Creation of " + directory + " directory failed.");
    }
    size=0;
  }
  this.directory=directory;
}

Impl ( File directory ) throws IOException { boolean exists = directory . exists ( ) ; if ( exists && ! directory . isDirectory ( ) ) { throw new IOException ( directory + " exists but is not a directory." ) ; } if ( exists ) { initialFiles = directory . list ( ) ; if ( initialFiles == null ) { throw new IOException ( directory + " exists but cannot list contents." ) ; } Arrays . sort ( initialFiles ) ; size = initialFiles . length ; } else { if ( ! directory . mkdirs ( ) ) { throw new IOException ( "Creation of " + directory + " directory failed." ) ; } size = 0 ; } this . directory = directory ; }
constructs a new cache backed by the given directory .
