Class FilterCodec

  • All Implemented Interfaces:
    Direct Known Subclasses:
    CompressingCodec, OakCodec

    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 Lucene46's LiveDocsFormat:

       public final class CustomCodec extends FilterCodec {
         public CustomCodec() {
           super("CustomCodec", new Lucene46Codec());
         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.