# Uses of Class
org.apache.lucene.store.Directory

Packages that use Directory
Package
Description
org.apache.lucene.codecs
Codecs API: API for customization of the encoding and structure of the index.
org.apache.lucene.codecs.lucene90
Lucene 9.0 file format.
org.apache.lucene.codecs.lucene90.compressing
Lucene 9.0 compressing format.
org.apache.lucene.codecs.lucene94
Lucene 9.4 file format.
org.apache.lucene.codecs.lucene99
Lucene 9.9 file format.
org.apache.lucene.index
Code to maintain and access indices.
org.apache.lucene.search
Code to search indices.
org.apache.lucene.store
Binary i/o API, used for all index data.
org.apache.lucene.util
Some utility classes.
org.apache.lucene.util.bkd
Block KD-tree, implementing the generic spatial data structure described in this paper.

## Uses of Directory in org.apache.lucene.codecs

Subclasses of Directory in org.apache.lucene.codecs
Modifier and Type
Class
Description
`class`
`CompoundDirectory`
A read-only `Directory` that consists of a view over a compound file.
Methods in org.apache.lucene.codecs with parameters of type Directory
Modifier and Type
Method
Description
`abstract StoredFieldsReader`
StoredFieldsFormat.`fieldsReader(Directory directory, SegmentInfo si, FieldInfos fn, IOContext context)`
Returns a `StoredFieldsReader` to load stored fields.
`abstract StoredFieldsWriter`
StoredFieldsFormat.`fieldsWriter(Directory directory, SegmentInfo si, IOContext context)`
Returns a `StoredFieldsWriter` to write stored fields.
`abstract CompoundDirectory`
CompoundFormat.`getCompoundReader(Directory dir, SegmentInfo si, IOContext context)`
Returns a Directory view (read-only) for the compound files in this segment
`abstract FieldInfos`
FieldInfosFormat.`read(Directory directory, SegmentInfo segmentInfo, String segmentSuffix, IOContext iocontext)`
Read the `FieldInfos` previously written with `FieldInfosFormat.write(org.apache.lucene.store.Directory, org.apache.lucene.index.SegmentInfo, java.lang.String, org.apache.lucene.index.FieldInfos, org.apache.lucene.store.IOContext)`.
`abstract SegmentInfo`
SegmentInfoFormat.`read(Directory directory, String segmentName, byte[] segmentID, IOContext context)`
Read `SegmentInfo` data from a directory.
`abstract Bits`
LiveDocsFormat.`readLiveDocs(Directory dir, SegmentCommitInfo info, IOContext context)`
Read live docs bits.
`abstract TermVectorsReader`
TermVectorsFormat.`vectorsReader(Directory directory, SegmentInfo segmentInfo, FieldInfos fieldInfos, IOContext context)`
Returns a `TermVectorsReader` to read term vectors.
`abstract TermVectorsWriter`
TermVectorsFormat.`vectorsWriter(Directory directory, SegmentInfo segmentInfo, IOContext context)`
Returns a `TermVectorsWriter` to write term vectors.
`abstract void`
CompoundFormat.`write(Directory dir, SegmentInfo si, IOContext context)`
Packs the provided segment's files into a compound format.
`abstract void`
FieldInfosFormat.`write(Directory directory, SegmentInfo segmentInfo, String segmentSuffix, FieldInfos infos, IOContext context)`
Writes the provided `FieldInfos` to the directory.
`abstract void`
SegmentInfoFormat.`write(Directory dir, SegmentInfo info, IOContext ioContext)`
Write `SegmentInfo` data.
`abstract void`
LiveDocsFormat.`writeLiveDocs(Bits bits, Directory dir, SegmentCommitInfo info, int newDelCount, IOContext context)`
Persist live docs bits.

## Uses of Directory in org.apache.lucene.codecs.lucene90

Methods in org.apache.lucene.codecs.lucene90 with parameters of type Directory
Modifier and Type
Method
Description
`StoredFieldsReader`
Lucene90StoredFieldsFormat.`fieldsReader(Directory directory, SegmentInfo si, FieldInfos fn, IOContext context)`
`StoredFieldsWriter`
Lucene90StoredFieldsFormat.`fieldsWriter(Directory directory, SegmentInfo si, IOContext context)`
`CompoundDirectory`
Lucene90CompoundFormat.`getCompoundReader(Directory dir, SegmentInfo si, IOContext context)`
`Bits`
Lucene90LiveDocsFormat.`readLiveDocs(Directory dir, SegmentCommitInfo info, IOContext context)`
`void`
Lucene90CompoundFormat.`write(Directory dir, SegmentInfo si, IOContext context)`
`void`
Lucene90LiveDocsFormat.`writeLiveDocs(Bits bits, Directory dir, SegmentCommitInfo info, int newDelCount, IOContext context)`

## Uses of Directory in org.apache.lucene.codecs.lucene90.compressing

Methods in org.apache.lucene.codecs.lucene90.compressing with parameters of type Directory
Modifier and Type
Method
Description
`StoredFieldsReader`
Lucene90CompressingStoredFieldsFormat.`fieldsReader(Directory directory, SegmentInfo si, FieldInfos fn, IOContext context)`
`StoredFieldsWriter`
Lucene90CompressingStoredFieldsFormat.`fieldsWriter(Directory directory, SegmentInfo si, IOContext context)`
`final TermVectorsReader`
Lucene90CompressingTermVectorsFormat.`vectorsReader(Directory directory, SegmentInfo segmentInfo, FieldInfos fieldInfos, IOContext context)`
`final TermVectorsWriter`
Lucene90CompressingTermVectorsFormat.`vectorsWriter(Directory directory, SegmentInfo segmentInfo, IOContext context)`
Constructors in org.apache.lucene.codecs.lucene90.compressing with parameters of type Directory
Modifier
Constructor
Description
``
`Lucene90CompressingStoredFieldsReader(Directory d, SegmentInfo si, String segmentSuffix, FieldInfos fn, IOContext context, String formatName, CompressionMode compressionMode)`
Sole constructor.
``
`Lucene90CompressingTermVectorsReader(Directory d, SegmentInfo si, String segmentSuffix, FieldInfos fn, IOContext context, String formatName, CompressionMode compressionMode)`
Sole constructor.

## Uses of Directory in org.apache.lucene.codecs.lucene94

Methods in org.apache.lucene.codecs.lucene94 with parameters of type Directory
Modifier and Type
Method
Description
`FieldInfos`
Lucene94FieldInfosFormat.`read(Directory directory, SegmentInfo segmentInfo, String segmentSuffix, IOContext context)`
`void`
Lucene94FieldInfosFormat.`write(Directory directory, SegmentInfo segmentInfo, String segmentSuffix, FieldInfos infos, IOContext context)`

## Uses of Directory in org.apache.lucene.codecs.lucene99

Methods in org.apache.lucene.codecs.lucene99 with parameters of type Directory
Modifier and Type
Method
Description
`SegmentInfo`
Lucene99SegmentInfoFormat.`read(Directory dir, String segment, byte[] segmentID, IOContext context)`
`void`
Lucene99SegmentInfoFormat.`write(Directory dir, SegmentInfo si, IOContext ioContext)`

## Uses of Directory in org.apache.lucene.index

Fields in org.apache.lucene.index declared as Directory
Modifier and Type
Field
Description
`Directory`
CheckIndex.Status.`dir`
Directory index is in.
`final Directory`
SegmentInfo.`dir`
Where this segment resides.
`protected final Directory`
DirectoryReader.`directory`
The index directory.
`final Directory`
SegmentReadState.`directory`
`Directory` where this segment is read from.
`final Directory`
SegmentWriteState.`directory`
`Directory` where this segment will be written to.
Methods in org.apache.lucene.index that return Directory
Modifier and Type
Method
Description
`final Directory`
DirectoryReader.`directory()`
Returns the directory this index resides in.
`Directory`
SegmentReader.`directory()`
Returns the directory this index resides in.
`abstract Directory`
IndexCommit.`getDirectory()`
Returns the `Directory` for the index.
`Directory`
IndexWriter.`getDirectory()`
Returns the Directory used by this index.
`Directory`
ConcurrentMergeScheduler.`wrapForMerge(MergePolicy.OneMerge merge, Directory in)`
`Directory`
MergeScheduler.`wrapForMerge(MergePolicy.OneMerge merge, Directory in)`
Wraps the incoming `Directory` so that we can merge-throttle it using `RateLimitedIndexOutput`.
`Directory`
NoMergeScheduler.`wrapForMerge(MergePolicy.OneMerge merge, Directory in)`
Methods in org.apache.lucene.index with parameters of type Directory
Modifier and Type
Method
Description
`long`
IndexWriter.`addIndexes(Directory... dirs)`
Adds all segments from an array of indexes into this index.
`final void`
SegmentInfos.`commit(Directory dir)`
Writes and syncs to the Directory dir, taking care to remove the segments file on exception
`static long`
SegmentInfos.`getLastCommitGeneration(Directory directory)`
Get the generation of the most recent commit to the index in this directory (N in the segments_N file).
`static String`
SegmentInfos.`getLastCommitSegmentsFileName(Directory directory)`
Get the filename of the segments_N file for the most recent commit to the index in this Directory.
`static boolean`
DirectoryReader.`indexExists(Directory directory)`
Returns `true` if an index likely exists at the specified directory.
`static List<IndexCommit>`
DirectoryReader.`listCommits(Directory dir)`
Returns all commit points that exist in the Directory.
`static DirectoryReader`
DirectoryReader.`open(Directory directory)`
Returns a IndexReader reading the index in the given Directory
`static DirectoryReader`
DirectoryReader.`open(Directory directory, Comparator<LeafReader> leafSorter)`
Returns a IndexReader for the index in the given Directory
`static DirectoryReader`
StandardDirectoryReader.`open(Directory directory, SegmentInfos infos, List<? extends LeafReader> oldReaders, Comparator<LeafReader> leafSorter)`
This constructor is only used for `StandardDirectoryReader.doOpenIfChanged(SegmentInfos)`, as well as NRT replication.
`static final SegmentInfos`
SegmentInfos.`readCommit(Directory directory, String segmentFileName)`
Read a particular segmentFileName.
`static final SegmentInfos`
SegmentInfos.`readCommit(Directory directory, ChecksumIndexInput input, long generation)`
Read the commit from the provided `ChecksumIndexInput`.
`static final SegmentInfos`
SegmentInfos.`readLatestCommit(Directory directory)`
Find the latest commit (`segments_N file`) and load all `SegmentCommitInfo`s.
`static final SegmentInfos`
SegmentInfos.`readLatestCommit(Directory directory, int minSupportedMajorVersion)`
Find the latest commit (`segments_N file`) and load all `SegmentCommitInfo`s, as long as the commit's `SegmentInfos.getIndexCreatedVersionMajor()` is strictly greater than the provided minimum supported major version.
`Sorter.DocMap`
MergePolicy.OneMerge.`reorder(CodecReader reader, Directory dir, Executor executor)`
Extend this method if you wish to renumber doc IDs.
`String`
MergePolicy.MergeSpecification.`segString(Directory dir)`
Returns a description of the merges in this specification.
`Directory`
ConcurrentMergeScheduler.`wrapForMerge(MergePolicy.OneMerge merge, Directory in)`
`Directory`
MergeScheduler.`wrapForMerge(MergePolicy.OneMerge merge, Directory in)`
Wraps the incoming `Directory` so that we can merge-throttle it using `RateLimitedIndexOutput`.
`Directory`
NoMergeScheduler.`wrapForMerge(MergePolicy.OneMerge merge, Directory in)`
Constructors in org.apache.lucene.index with parameters of type Directory
Modifier
Constructor
Description
``
`CheckIndex(Directory dir)`
Create a new CheckIndex on the directory.
``
`CheckIndex(Directory dir, Lock writeLock)`
Expert: create a directory with the specified lock.
`protected`
`DirectoryReader(Directory directory, LeafReader[] segmentReaders, Comparator<LeafReader> leafSorter)`
Expert: Constructs a `DirectoryReader` on the given subReaders.
`protected`
`FindSegmentsFile(Directory directory)`
Sole constructor.
``
`IndexUpgrader(Directory dir)`
Creates index upgrader on the given directory, using an `IndexWriter` using the given `matchVersion`.
``
`IndexUpgrader(Directory dir, IndexWriterConfig iwc, boolean deletePriorCommits)`
Creates index upgrader on the given directory, using an `IndexWriter` using the given config.
``
`IndexUpgrader(Directory dir, InfoStream infoStream, boolean deletePriorCommits)`
Creates index upgrader on the given directory, using an `IndexWriter` using the given `matchVersion`.
``
`IndexWriter(Directory d, IndexWriterConfig conf)`
Constructs a new IndexWriter per the settings given in `conf`.
``
`PersistentSnapshotDeletionPolicy(IndexDeletionPolicy primary, Directory dir)`
`PersistentSnapshotDeletionPolicy` wraps another `IndexDeletionPolicy` to enable flexible snapshotting, passing `IndexWriterConfig.OpenMode.CREATE_OR_APPEND` by default.
``
`PersistentSnapshotDeletionPolicy(IndexDeletionPolicy primary, Directory dir, IndexWriterConfig.OpenMode mode)`
`PersistentSnapshotDeletionPolicy` wraps another `IndexDeletionPolicy` to enable flexible snapshotting.
``
`ReaderManager(Directory dir)`
Creates and returns a new ReaderManager from the given `Directory`.
``
`SegmentInfo(Directory dir, Version version, Version minVersion, String name, int maxDoc, boolean isCompoundFile, boolean hasBlocks, Codec codec, Map<String,String> diagnostics, byte[] id, Map<String,String> attributes, Sort indexSort)`
Construct a new complete SegmentInfo instance from input.
``
`SegmentReadState(Directory dir, SegmentInfo info, FieldInfos fieldInfos, IOContext context)`
Create a `SegmentReadState`.
``
`SegmentReadState(Directory dir, SegmentInfo info, FieldInfos fieldInfos, IOContext context, String segmentSuffix)`
Create a `SegmentReadState`.
``
`SegmentWriteState(InfoStream infoStream, Directory directory, SegmentInfo segmentInfo, FieldInfos fieldInfos, org.apache.lucene.index.BufferedUpdates segUpdates, IOContext context)`
Sole constructor.
``
`SegmentWriteState(InfoStream infoStream, Directory directory, SegmentInfo segmentInfo, FieldInfos fieldInfos, org.apache.lucene.index.BufferedUpdates segUpdates, IOContext context, String segmentSuffix)`
Constructor which takes segment suffix.

## Uses of Directory in org.apache.lucene.search

Constructors in org.apache.lucene.search with parameters of type Directory
Modifier
Constructor
Description
``
`SearcherManager(Directory dir, SearcherFactory searcherFactory)`
Creates and returns a new SearcherManager from the given `Directory`.

## Uses of Directory in org.apache.lucene.store

Subclasses of Directory in org.apache.lucene.store
Modifier and Type
Class
Description
`class`
`BaseDirectory`
Base implementation for a concrete `Directory` that uses a `LockFactory` for locking.
`final class`
`ByteBuffersDirectory`
A `ByteBuffer`-based `Directory` implementation that can be used to store index files on the heap.
`class`
`FileSwitchDirectory`
Expert: A Directory instance that switches files between two other Directory instances.
`class`
`FilterDirectory`
Directory implementation that delegates calls to another directory.
`class`
`FSDirectory`
Base class for Directory implementations that store index files in the file system.
`final class`
`LockValidatingDirectoryWrapper`
This class makes a best-effort check that a provided `Lock` is valid before any destructive filesystem operation.
`class`
`MMapDirectory`
File-based `Directory` implementation that uses mmap for reading, and `FSDirectory.FSIndexOutput` for writing.
`class`
`NIOFSDirectory`
An `FSDirectory` implementation that uses java.nio's FileChannel's positional read, which allows multiple threads to read from the same file without synchronizing.
`class`
`NRTCachingDirectory`
Wraps a RAM-resident directory around any provided delegate directory, to be used during NRT search.
`final class`
`SleepingLockWrapper`
Directory that wraps another, and that sleeps and retries if obtaining the lock fails.
`final class`
`TrackingDirectoryWrapper`
A delegating Directory that records which files were written to and deleted.
Fields in org.apache.lucene.store declared as Directory
Modifier and Type
Field
Description
`protected final Directory`
FilterDirectory.`in`
Methods in org.apache.lucene.store that return Directory
Modifier and Type
Method
Description
`final Directory`
FilterDirectory.`getDelegate()`
Return the wrapped `Directory`.
`Directory`
FileSwitchDirectory.`getPrimaryDir()`
Return the primary directory
`Directory`
FileSwitchDirectory.`getSecondaryDir()`
Return the secondary directory
`static Directory`
FilterDirectory.`unwrap(Directory dir)`
Get the wrapped instance by `dir` as long as this reader is an instance of `FilterDirectory`.
Methods in org.apache.lucene.store with parameters of type Directory
Modifier and Type
Method
Description
`void`
Directory.`copyFrom(Directory from, String src, String dest, IOContext context)`
Copies an existing `src` file from directory `from` to a non-existent file `dest` in this directory.
`void`
LockValidatingDirectoryWrapper.`copyFrom(Directory from, String src, String dest, IOContext context)`
`void`
TrackingDirectoryWrapper.`copyFrom(Directory from, String src, String dest, IOContext context)`
`final Lock`
FSLockFactory.`obtainLock(Directory dir, String lockName)`
`abstract Lock`
LockFactory.`obtainLock(Directory dir, String lockName)`
Return a new obtained Lock instance identified by lockName.
`Lock`
NoLockFactory.`obtainLock(Directory dir, String lockName)`
`Lock`
SingleInstanceLockFactory.`obtainLock(Directory dir, String lockName)`
`Lock`
VerifyingLockFactory.`obtainLock(Directory dir, String lockName)`
`static Directory`
FilterDirectory.`unwrap(Directory dir)`
Get the wrapped instance by `dir` as long as this reader is an instance of `FilterDirectory`.
Constructors in org.apache.lucene.store with parameters of type Directory
Modifier
Constructor
Description
``
`FileSwitchDirectory(Set<String> primaryExtensions, Directory primaryDir, Directory secondaryDir, boolean doClose)`
`protected`
`FilterDirectory(Directory in)`
Sole constructor, typically called from sub-classes.
``
`LockValidatingDirectoryWrapper(Directory in, Lock writeLock)`
``
`NRTCachingDirectory(Directory delegate, double maxMergeSizeMB, double maxCachedMB)`
We will cache a newly created output if 1) it's a flush or a merge and the estimated size of the merged segment is `<= maxMergeSizeMB`, and 2) the total cached bytes is `<= maxCachedMB`
``
`SleepingLockWrapper(Directory delegate, long lockWaitTimeout)`
Create a new SleepingLockFactory
``
`SleepingLockWrapper(Directory delegate, long lockWaitTimeout, long pollInterval)`
Create a new SleepingLockFactory
``
`TrackingDirectoryWrapper(Directory in)`

## Uses of Directory in org.apache.lucene.util

Methods in org.apache.lucene.util that return Directory
Modifier and Type
Method
Description
`Directory`
OfflineSorter.`getDirectory()`
Returns the `Directory` we use to create temp files.
Methods in org.apache.lucene.util that return types with arguments of type Directory
Modifier and Type
Method
Description
`static Class<? extends Directory>`
CommandLineUtil.`loadDirectoryClass(String clazzName)`
Loads a specific Directory implementation
Methods in org.apache.lucene.util with parameters of type Directory
Modifier and Type
Method
Description
`static void`
IOUtils.`deleteFiles(Directory dir, Collection<String> names)`
Deletes all given file names.
`static void`
IOUtils.`deleteFilesIgnoringExceptions(Directory dir, String... files)`
`static void`
IOUtils.`deleteFilesIgnoringExceptions(Directory dir, Collection<String> files)`
Deletes all given files, suppressing all thrown IOExceptions.
Constructors in org.apache.lucene.util with parameters of type Directory
Modifier
Constructor
Description
``
`FileDeleter(Directory directory, BiConsumer<FileDeleter.MsgType,String> messenger)`
Create a new FileDeleter with a messenger consumes various verbose messages
``
`OfflineSorter(Directory dir, String tempFileNamePrefix)`
Defaults constructor.
``
`OfflineSorter(Directory dir, String tempFileNamePrefix, Comparator<BytesRef> comparator)`
Defaults constructor with a custom comparator.
``
`OfflineSorter(Directory dir, String tempFileNamePrefix, Comparator<BytesRef> comparator, OfflineSorter.BufferSize ramBufferSize, int maxTempfiles, int valueLength, ExecutorService exec, int maxPartitionsInRAM)`
All-details constructor.

## Uses of Directory in org.apache.lucene.util.bkd

Constructors in org.apache.lucene.util.bkd with parameters of type Directory
Modifier
Constructor
Description
``
`BKDRadixSelector(BKDConfig config, int maxPointsSortInHeap, Directory tempDir, String tempFileNamePrefix)`
Sole constructor.
``
`BKDWriter(int maxDoc, Directory tempDir, String tempFileNamePrefix, BKDConfig config, double maxMBSortInHeap, long totalPointCount)`
``
`OfflinePointReader(BKDConfig config, Directory tempDir, String tempFileName, long start, long length, byte[] reusableBuffer)`
``
`OfflinePointWriter(BKDConfig config, Directory tempDir, String tempFileNamePrefix, String desc, long expectedCount)`
Create a new writer with an unknown number of incoming points