Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class NIOFSDirectory

    An FSDirectory implementation that uses FileStream's positional read, which allows multiple threads to read from the same file without synchronizing.

    This class only uses FileStream when reading; writing is achieved with FSDirectory.FSIndexOutput.

    NOTE: Since the .NET NIOFSDirectory uses additional seeking during reads, it will generally be slightly less efficient than SimpleFSDirectory. This class has poor concurrent read performance (multiple threads will bottleneck) as it synchronizes when multiple threads read from the same file. It's usually better to use MMapDirectory for reading.

    NOTE: Unlike in Java, it is not recommended to use Interrupt() in .NET in conjunction with an open FSDirectory because it is not guaranteed to exit atomically. Any lock statement or Enter(object) call can throw a ThreadInterruptedException, which makes shutting down unpredictable. To exit parallel tasks safely, we recommend using Tasks and "interrupt" them with CancellationTokens.
    Inheritance
    object
    Directory
    BaseDirectory
    FSDirectory
    NIOFSDirectory
    Implements
    IDisposable
    Inherited Members
    FSDirectory.DEFAULT_READ_CHUNK_SIZE
    FSDirectory.m_directory
    FSDirectory.m_staleFiles
    FSDirectory.m_syncLock
    FSDirectory.Open(DirectoryInfo)
    FSDirectory.Open(string)
    FSDirectory.Open(DirectoryInfo, LockFactory)
    FSDirectory.Open(string, LockFactory)
    FSDirectory.SetLockFactory(LockFactory)
    FSDirectory.ListAll(DirectoryInfo)
    FSDirectory.ListAll()
    FSDirectory.FileExists(string)
    FSDirectory.FileLength(string)
    FSDirectory.DeleteFile(string)
    FSDirectory.CreateOutput(string, IOContext)
    FSDirectory.EnsureCanWrite(string)
    FSDirectory.OnIndexOutputClosed(FSDirectory.FSIndexOutput)
    FSDirectory.Sync(ICollection<string>)
    FSDirectory.GetLockID()
    FSDirectory.Dispose(bool)
    FSDirectory.Directory
    FSDirectory.ToString()
    FSDirectory.ReadChunkSize
    FSDirectory.Fsync(string)
    BaseDirectory.IsOpen
    BaseDirectory.CompareAndSetIsOpen(bool, bool)
    BaseDirectory.m_lockFactory
    BaseDirectory.MakeLock(string)
    BaseDirectory.ClearLock(string)
    BaseDirectory.LockFactory
    BaseDirectory.EnsureOpen()
    Directory.OpenChecksumInput(string, IOContext)
    Directory.Dispose()
    Directory.Copy(Directory, string, string, IOContext)
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: Lucene.Net.Store
    Assembly: Lucene.Net.dll
    Syntax
    public class NIOFSDirectory : FSDirectory, IDisposable

    Constructors

    NIOFSDirectory(DirectoryInfo)

    Create a new NIOFSDirectory for the named location and NativeFSLockFactory.

    Declaration
    public NIOFSDirectory(DirectoryInfo path)
    Parameters
    Type Name Description
    DirectoryInfo path

    the path of the directory

    Exceptions
    Type Condition
    IOException

    if there is a low-level I/O error

    NIOFSDirectory(DirectoryInfo, LockFactory)

    Create a new NIOFSDirectory for the named location.

    Declaration
    public NIOFSDirectory(DirectoryInfo path, LockFactory lockFactory)
    Parameters
    Type Name Description
    DirectoryInfo path

    the path of the directory

    LockFactory lockFactory

    the lock factory to use, or null for the default (NativeFSLockFactory);

    Exceptions
    Type Condition
    IOException

    if there is a low-level I/O error

    NIOFSDirectory(string)

    Create a new NIOFSDirectory for the named location and NativeFSLockFactory.

    LUCENENET specific overload for convenience using string instead of DirectoryInfo.
    Declaration
    public NIOFSDirectory(string path)
    Parameters
    Type Name Description
    string path

    the path of the directory

    Exceptions
    Type Condition
    IOException

    if there is a low-level I/O error

    NIOFSDirectory(string, LockFactory)

    Create a new NIOFSDirectory for the named location.

    LUCENENET specific overload for convenience using string instead of DirectoryInfo.
    Declaration
    public NIOFSDirectory(string path, LockFactory lockFactory)
    Parameters
    Type Name Description
    string path

    the path of the directory

    LockFactory lockFactory

    the lock factory to use, or null for the default (NativeFSLockFactory);

    Exceptions
    Type Condition
    IOException

    if there is a low-level I/O error

    Methods

    CreateSlicer(string, IOContext)

    Creates an Directory.IndexInputSlicer for the given file name. Directory.IndexInputSlicer allows other Directory implementations to efficiently open one or more sliced IndexInput instances from a single file handle. The underlying file handle is kept open until the Directory.IndexInputSlicer is closed.

    Throws FileNotFoundException if the file does not exist.

    Note

    This API is for internal purposes only and might change in incompatible ways in the next release.

    Note

    This API is experimental and might change in incompatible ways in the next release.

    Declaration
    public override Directory.IndexInputSlicer CreateSlicer(string name, IOContext context)
    Parameters
    Type Name Description
    string name
    IOContext context
    Returns
    Type Description
    Directory.IndexInputSlicer
    Overrides
    Directory.CreateSlicer(string, IOContext)
    Exceptions
    Type Condition
    IOException

    if an IOException occurs

    OpenInput(string, IOContext)

    Creates an IndexInput for the file with the given name.

    Declaration
    public override IndexInput OpenInput(string name, IOContext context)
    Parameters
    Type Name Description
    string name
    IOContext context
    Returns
    Type Description
    IndexInput
    Overrides
    Directory.OpenInput(string, IOContext)

    Implements

    IDisposable
    Back to top Copyright © 2024 The Apache Software Foundation, Licensed under the Apache License, Version 2.0
    Apache Lucene.Net, Lucene.Net, Apache, the Apache feather logo, and the Apache Lucene.Net project logo are trademarks of The Apache Software Foundation.
    All other marks mentioned may be trademarks or registered trademarks of their respective owners.