private void create() throws IOException { if (directory.exists()) { String[] files = directory.list(IndexFileNameFilter.getFilter()); // clear old files if (files == null) throw new IOException("cannot read directory " + directory.getAbsolutePath() + ": list() returned null"); for (int i = 0; i < files.length; i++) { File file = new File(directory, files[i]); if (!file.delete()) throw new IOException("Cannot delete " + file); } } lockFactory.clearLock(IndexWriter.WRITE_LOCK_NAME); }
/** Returns an array of strings, one for each Lucene index file in the directory. */ public String[] list() { ensureOpen(); return directory.list(IndexFileNameFilter.getFilter()); }
private LuceneIndexFileNameFilter() { luceneFilter = IndexFileNameFilter.getFilter(); }