class SubstringFilter implements Filter {

  @Override
  public DEREncoder getEncoder()
  {
    final DEREncoder[] encoders = new DEREncoder[getAssertionCount()];
    int i = 0;
    if (subInitial != null) {
      encoders[i++] = new OctetStringType(
        new ContextDERTag(Substrings.INITIAL.ordinal(), false), subInitial);
    }
    if (subAny != null && subAny.length > 0) {
      for (byte[] assertion : subAny) {
        encoders[i++] = new OctetStringType(new ContextDERTag(Substrings.ANY.ordinal(), false), assertion);
      }
    }
    if (subFinal != null) {
      encoders[i] = new OctetStringType(
        new ContextDERTag(Substrings.FINAL.ordinal(), false), subFinal);
    }
    return new ConstructedDEREncoder(
      new ContextDERTag(Filter.Type.SUBSTRING.ordinal(), true),
      new OctetStringType(attributeDesc),
      new ConstructedDEREncoder(
        UniversalDERTag.SEQ,
        encoders));
  }

  public  SubstringFilter(final String name, final String startsWith, final String endsWith, final String... contains);
  public  SubstringFilter(final String name, final byte[] startsWith, final byte[] endsWith, final byte[]... contains);

}