I. Classification of directory
Directory can be divided into two types: Memory directory and file directory.
1. The memory directory is ramdirectory.
2. File directory: fsdirectory
Fsdirectory is divided into three categories:
1) simplefsdirectory in Windows
2) Linux supports NiO niofsdirectory
3) Another is the memory map directory mmapdirectory.
Simplefsdirectory is a simple implementation of fsdirectory, and has limited concurrent processing capabilities. It is better to use mmapdirectory.
Niofsdirectory is a directory used in Linux and can provide good performance,
Ii. Tools inherited from directory
In addition, directory has two tool classes.
1. One is the fileswitchdirectory that can read files in two different directories at the same time. This is a proxy class.
2. You can only read files with the CFS extension by reading the compoundfilereader of the composite file. (Compoundfilewriter is used to write files with the CFS extension.) compoundfilereader is only referenced in segmentreader.
Iii. Correspondence between directory and read/write objects
Directory is an abstract class that defines the methods for obtaining read/write objects, createoutput () and openinput ().
Fsdirectory is an abstract class. Each class that inherits fsdirectory implements its own createoutput () and openinput () methods, and returns indexinput and indexoutput that match each directory of different types.
Objects returned by openinput:
Directory --> ramdirectory ==> indexinput --> raminputstream
Directory --> fsdirectory --> simplefsdirectory ==> indexinput --> bufferedindexinput --> simplefsindexinput
Directory --> fsdirectory --> niofsdirectory ==> indexinput --> bufferedindexinput --> niofsindexinput
Directory --> fsdirectory --> mmapdirectory ==> indexinput --> bufferedindexinput --> mmapindexinput/multimmapindexinput
Directory --> fileswitchdirectory ====> indexinput --> indexinput for cross-reading
Directory --> compoundfilereader ====> indexinput --> bufferedindexinput --> csindexinput
Objects returned by createoutput:
Directory --> ramdirectory ==> indexinput --> ramoutputstream
Directory --> fsdirectory --> simplefsdirectory ==> indexoutput --> bufferedindexoutput --> simplefsindexoutput
Directory --> fsdirectory --> niofsdirectory ==> indexoutput --> bufferedindexoutput --> simplefsdirectory. simplefsindexoutput
Directory --> fsdirectory --> mmapdirectory ==> indexoutput --> bufferedindexoutput --> simplefsdirectory. simplefsindexoutput
Directory --> fileswitchdirectory ====> indexinput --> indexinput for cross-reading
Directory --> compoundfilewriter ====> compoundfilewriter does not inherit indexoutput because compoundfilewriter uses add (string file) to add, instead of writebytes ()