org.apache.lucene.codecs

## Class SegmentInfoFormat

- java.lang.Object
- - org.apache.lucene.codecs.SegmentInfoFormat

- Direct Known Subclasses:
    Lucene86SegmentInfoFormat

      public abstract class SegmentInfoFormat
      extends Object

  Expert: Controls the format of the `SegmentInfo` (segment metadata file).
  See Also:
    `SegmentInfo`
  WARNING: This API is experimental and might change in incompatible ways in the next release.

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `SegmentInfoFormat()` Sole constructor.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract SegmentInfo` | `read(Directory directory, String segmentName, byte[] segmentID, IOContext context)` Read `SegmentInfo` data from a directory.
    `abstract void` | `write(Directory dir, SegmentInfo info, IOContext ioContext)` Write `SegmentInfo` data.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SegmentInfoFormat

          protected SegmentInfoFormat()

      Sole constructor. (For invocation by subclass constructors, typically implicit.)

  - ### Method Detail

    - #### read

          public abstract SegmentInfo read(Directory directory,
                                           String segmentName,
                                           byte[] segmentID,
                                           IOContext context)
                                    throws IOException

      Read `SegmentInfo` data from a directory.
      Parameters:
        `directory` - directory to read from
        `segmentName` - name of the segment to read
        `segmentID` - expected identifier for the segment
      Returns:
        infos instance to be populated with data
      Throws:
        `IOException` - If an I/O error occurs

    - #### write

          public abstract void write(Directory dir,
                                     SegmentInfo info,
                                     IOContext ioContext)
                              throws IOException

      Write `SegmentInfo` data. The codec must add its SegmentInfo filename(s) to `info` before doing i/o.
      Throws:
        `IOException` - If an I/O error occurs

Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.