Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class CompoundFileDirectory

    Class for accessing a compound stream. This class implements a directory, but is limited to only read operations. Directory methods that would normally modify data throw an exception.

    All files belonging to a segment have the same name with varying extensions. The extensions correspond to the different file formats used by the Codec. When using the Compound File format these files are collapsed into a single .cfs file (except for the LiveDocsFormat, with a corresponding .cfe file indexing its sub-files.

    Files:
    • .cfs: An optional "virtual" file consisting of all the other index files for systems that frequently run out of file handles.
    • .cfe: The "virtual" compound file's entry table holding all entries in the corresponding .cfs file.

    Description:

    • Compound (.cfs) --> Header, FileData FileCount
    • Compound Entry Table (.cfe) --> Header, FileCount, <FileName, DataOffset, DataLength> FileCount, Footer
    • Header --> WriteHeader(DataOutput, string, int)
    • FileCount --> WriteVInt32(int)
    • DataOffset,DataLength --> WriteInt64(long)
    • FileName --> WriteString(string)
    • FileData --> raw file data
    • Footer --> WriteFooter(IndexOutput)

    Notes:

    • FileCount indicates how many files are contained in this compound file. The entry table that follows has that many entries.
    • Each directory entry contains a long pointer to the start of this file's data section, the files length, and a string with that file's name.

    Note

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

    Inheritance
    object
    Directory
    BaseDirectory
    CompoundFileDirectory
    Implements
    IDisposable
    Inherited Members
    BaseDirectory.ClearLock(string)
    BaseDirectory.SetLockFactory(LockFactory)
    BaseDirectory.LockFactory
    Directory.OpenChecksumInput(string, IOContext)
    Directory.Dispose()
    Directory.GetLockID()
    Directory.Copy(Directory, string, string, IOContext)
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Lucene.Net.Store
    Assembly: Lucene.Net.dll
    Syntax
    public sealed class CompoundFileDirectory : BaseDirectory, IDisposable

    Constructors

    CompoundFileDirectory(Directory, string, IOContext, bool)

    Create a new CompoundFileDirectory.

    Declaration
    public CompoundFileDirectory(Directory directory, string fileName, IOContext context, bool openForWrite)
    Parameters
    Type Name Description
    Directory directory
    string fileName
    IOContext context
    bool openForWrite

    Properties

    Directory

    Class for accessing a compound stream. This class implements a directory, but is limited to only read operations. Directory methods that would normally modify data throw an exception.

    All files belonging to a segment have the same name with varying extensions. The extensions correspond to the different file formats used by the Codec. When using the Compound File format these files are collapsed into a single .cfs file (except for the LiveDocsFormat, with a corresponding .cfe file indexing its sub-files.

    Files:
    • .cfs: An optional "virtual" file consisting of all the other index files for systems that frequently run out of file handles.
    • .cfe: The "virtual" compound file's entry table holding all entries in the corresponding .cfs file.

    Description:

    • Compound (.cfs) --> Header, FileData FileCount
    • Compound Entry Table (.cfe) --> Header, FileCount, <FileName, DataOffset, DataLength> FileCount, Footer
    • Header --> WriteHeader(DataOutput, string, int)
    • FileCount --> WriteVInt32(int)
    • DataOffset,DataLength --> WriteInt64(long)
    • FileName --> WriteString(string)
    • FileData --> raw file data
    • Footer --> WriteFooter(IndexOutput)

    Notes:

    • FileCount indicates how many files are contained in this compound file. The entry table that follows has that many entries.
    • Each directory entry contains a long pointer to the start of this file's data section, the files length, and a string with that file's name.

    Note

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

    Declaration
    public Directory Directory { get; }
    Property Value
    Type Description
    Directory

    Name

    Class for accessing a compound stream. This class implements a directory, but is limited to only read operations. Directory methods that would normally modify data throw an exception.

    All files belonging to a segment have the same name with varying extensions. The extensions correspond to the different file formats used by the Codec. When using the Compound File format these files are collapsed into a single .cfs file (except for the LiveDocsFormat, with a corresponding .cfe file indexing its sub-files.

    Files:
    • .cfs: An optional "virtual" file consisting of all the other index files for systems that frequently run out of file handles.
    • .cfe: The "virtual" compound file's entry table holding all entries in the corresponding .cfs file.

    Description:

    • Compound (.cfs) --> Header, FileData FileCount
    • Compound Entry Table (.cfe) --> Header, FileCount, <FileName, DataOffset, DataLength> FileCount, Footer
    • Header --> WriteHeader(DataOutput, string, int)
    • FileCount --> WriteVInt32(int)
    • DataOffset,DataLength --> WriteInt64(long)
    • FileName --> WriteString(string)
    • FileData --> raw file data
    • Footer --> WriteFooter(IndexOutput)

    Notes:

    • FileCount indicates how many files are contained in this compound file. The entry table that follows has that many entries.
    • Each directory entry contains a long pointer to the start of this file's data section, the files length, and a string with that file's name.

    Note

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

    Declaration
    public string Name { get; }
    Property Value
    Type Description
    string

    Methods

    CreateOutput(string, IOContext)

    Creates a new, empty file in the directory with the given name. Returns a stream writing this file.

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

    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

    DeleteFile(string)

    Not implemented

    Declaration
    public override void DeleteFile(string name)
    Parameters
    Type Name Description
    string name
    Overrides
    Directory.DeleteFile(string)
    Exceptions
    Type Condition
    NotSupportedException

    always: not supported by CFS

    Dispose(bool)

    Disposes the store.

    Declaration
    protected override void Dispose(bool disposing)
    Parameters
    Type Name Description
    bool disposing
    Overrides
    Directory.Dispose(bool)

    FileExists(string)

    Returns true iff a file with the given name exists.

    Declaration
    [Obsolete("this method will be removed in 5.0")]
    public override bool FileExists(string name)
    Parameters
    Type Name Description
    string name
    Returns
    Type Description
    bool
    Overrides
    Directory.FileExists(string)

    FileLength(string)

    Returns the length of a file in the directory.

    Declaration
    public override long FileLength(string name)
    Parameters
    Type Name Description
    string name
    Returns
    Type Description
    long
    Overrides
    Directory.FileLength(string)
    Exceptions
    Type Condition
    IOException

    if the file does not exist

    ListAll()

    Returns an array of strings, one for each file in the directory.

    Declaration
    public override string[] ListAll()
    Returns
    Type Description
    string[]
    Overrides
    Directory.ListAll()

    MakeLock(string)

    Not implemented

    Declaration
    public override Lock MakeLock(string name)
    Parameters
    Type Name Description
    string name
    Returns
    Type Description
    Lock
    Overrides
    BaseDirectory.MakeLock(string)
    Exceptions
    Type Condition
    NotSupportedException

    always: not supported by CFS

    OpenInput(string, IOContext)

    Returns a stream reading an existing file, with the specified read buffer size. The particular Directory implementation may ignore the buffer size. Currently the only Directory implementations that respect this parameter are FSDirectory and CompoundFileDirectory.

    Throws FileNotFoundException if the file does not exist.
    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)

    RenameFile(string, string)

    Not implemented

    Declaration
    public void RenameFile(string from, string to)
    Parameters
    Type Name Description
    string from
    string to
    Exceptions
    Type Condition
    NotSupportedException

    always: not supported by CFS

    Sync(ICollection<string>)

    Ensure that any writes to these files are moved to stable storage. Lucene uses this to properly commit changes to the index, to prevent a machine/OS crash from corrupting the index.

    NOTE: Clients may call this method for same files over and over again, so some impls might optimize for that. For other impls the operation can be a noop, for various reasons.

    Declaration
    public override void Sync(ICollection<string> names)
    Parameters
    Type Name Description
    ICollection<string> names
    Overrides
    Directory.Sync(ICollection<string>)

    ToString()

    Returns a string that represents the current object.

    Declaration
    public override string ToString()
    Returns
    Type Description
    string

    A string that represents the current object.

    Overrides
    Directory.ToString()

    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.