code: public boolean shouldEncode(Encoder encoderToApply, EncodingState encodingState) {
          return ignoreEncodingState || (encoderToApply != null
                  && (encodingState == null || shouldEncodeWith(encoderToApply, encodingState)));
      }
docs: Check if the encoder should be used to a input with certain encodingState
  
  @param encoderToApply
  the encoder to apply
  @param encodingState
  the current encoding state
  @return true, if should encode