org.apache.lucene.codecs

Class 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.