org.apache.lucene.codecs

## Class FilterCodec

- java.lang.Object
- - org.apache.lucene.codecs.Codec
  - - org.apache.lucene.codecs.FilterCodec

- All Implemented Interfaces:
    NamedSPILoader.NamedSPI

      public abstract class FilterCodec
      extends Codec

  A codec that forwards all its method calls to another codec.

  Extend this class when you need to reuse the functionality of an existing codec. For example, if you want to build a codec that redefines LuceneMN's `LiveDocsFormat`:

         public final class CustomCodec extends FilterCodec {

           public CustomCodec() {
             super("CustomCodec", new LuceneMNCodec());
           }

           public LiveDocsFormat liveDocsFormat() {
             return new CustomLiveDocsFormat();
           }

         }

  Please note: Don't call `Codec.forName(java.lang.String)` from the no-arg constructor of your own codec. When the SPI framework loads your own Codec as SPI component, SPI has not yet fully initialized! If you want to extend another Codec, instantiate it directly by calling its constructor.

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

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Codec` | `delegate` The codec to filter.

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `FilterCodec(String name, Codec delegate)` Sole constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `CompoundFormat` | `compoundFormat()` Encodes/decodes compound files
    `DocValuesFormat` | `docValuesFormat()` Encodes/decodes docvalues
    `FieldInfosFormat` | `fieldInfosFormat()` Encodes/decodes field infos file
    `LiveDocsFormat` | `liveDocsFormat()` Encodes/decodes live docs
    `NormsFormat` | `normsFormat()` Encodes/decodes document normalization values
    `PointsFormat` | `pointsFormat()` Encodes/decodes points index
    `PostingsFormat` | `postingsFormat()` Encodes/decodes postings
    `SegmentInfoFormat` | `segmentInfoFormat()` Encodes/decodes segment info file
    `StoredFieldsFormat` | `storedFieldsFormat()` Encodes/decodes stored fields
    `TermVectorsFormat` | `termVectorsFormat()` Encodes/decodes term vectors

    - ### Methods inherited from class org.apache.lucene.codecs.Codec

      `availableCodecs, forName, getDefault, getName, reloadCodecs, setDefault, toString`

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

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

- - ### Field Detail

    - #### delegate

          protected final Codec delegate

      The codec to filter.

  - ### Constructor Detail

    - #### FilterCodec

          protected FilterCodec(String name,
                                Codec delegate)

      Sole constructor. When subclassing this codec, create a no-arg ctor and pass the delegate codec and a unique name to this ctor.

  - ### Method Detail

    - #### docValuesFormat

          public DocValuesFormat docValuesFormat()

      Description copied from class: `Codec`
      Encodes/decodes docvalues
      Specified by:
        `docValuesFormat` in class `Codec`

    - #### fieldInfosFormat

          public FieldInfosFormat fieldInfosFormat()

      Description copied from class: `Codec`
      Encodes/decodes field infos file
      Specified by:
        `fieldInfosFormat` in class `Codec`

    - #### liveDocsFormat

          public LiveDocsFormat liveDocsFormat()

      Description copied from class: `Codec`
      Encodes/decodes live docs
      Specified by:
        `liveDocsFormat` in class `Codec`

    - #### normsFormat

          public NormsFormat normsFormat()

      Description copied from class: `Codec`
      Encodes/decodes document normalization values
      Specified by:
        `normsFormat` in class `Codec`

    - #### postingsFormat

          public PostingsFormat postingsFormat()

      Description copied from class: `Codec`
      Encodes/decodes postings
      Specified by:
        `postingsFormat` in class `Codec`

    - #### segmentInfoFormat

          public SegmentInfoFormat segmentInfoFormat()

      Description copied from class: `Codec`
      Encodes/decodes segment info file
      Specified by:
        `segmentInfoFormat` in class `Codec`

    - #### storedFieldsFormat

          public StoredFieldsFormat storedFieldsFormat()

      Description copied from class: `Codec`
      Encodes/decodes stored fields
      Specified by:
        `storedFieldsFormat` in class `Codec`

    - #### termVectorsFormat

          public TermVectorsFormat termVectorsFormat()

      Description copied from class: `Codec`
      Encodes/decodes term vectors
      Specified by:
        `termVectorsFormat` in class `Codec`

    - #### compoundFormat

          public CompoundFormat compoundFormat()

      Description copied from class: `Codec`
      Encodes/decodes compound files
      Specified by:
        `compoundFormat` in class `Codec`

    - #### pointsFormat

          public PointsFormat pointsFormat()

      Description copied from class: `Codec`
      Encodes/decodes points index
      Specified by:
        `pointsFormat` in class `Codec`

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