Class DefaultEncodingStateRegistry

    • Constructor Detail

      • DefaultEncodingStateRegistry

        public DefaultEncodingStateRegistry()
    • Method Detail

      • isEncodedWith

        public boolean isEncodedWith​(Encoder encoder,
                                     java.lang.CharSequence string)
        Description copied from interface: EncodingStateRegistry
        Checks if the CharSequence is encoded with encoder.
        Specified by:
        isEncodedWith in interface EncodingStateRegistry
        Parameters:
        encoder - the encoder
        string - a CharSequence
        Returns:
        true, if it is encoded with encoder
      • registerEncodedWith

        public void registerEncodedWith​(Encoder encoder,
                                        java.lang.CharSequence escaped)
        Description copied from interface: EncodingStateRegistry
        Registers that the CharSequence has been encoded with encoder
        Specified by:
        registerEncodedWith in interface EncodingStateRegistry
        Parameters:
        encoder - the encoder
        escaped - the CharSequence
      • shouldEncodeWith

        public boolean shouldEncodeWith​(Encoder encoderToApply,
                                        java.lang.CharSequence string)
        Description copied from interface: EncodingStateRegistry
        Checks if a encoder should be applied to a CharSequence
        Specified by:
        shouldEncodeWith in interface EncodingStateRegistry
        Parameters:
        encoderToApply - the encoder to apply
        string - a CharSequence
        Returns:
        true, if it should be applied
      • shouldEncodeWith

        public static boolean shouldEncodeWith​(Encoder encoderToApply,
                                               EncodingState currentEncodingState)
        Checks if encoder should be applied to a input with given encoding state
        Parameters:
        encoderToApply - the encoder to apply
        currentEncodingState - the current encoding state
        Returns:
        true, if should encode
      • isNoneEncoder

        public static boolean isNoneEncoder​(Encoder encoderToApply)
      • isPreviousEncoderSafeOrEqual

        public static boolean isPreviousEncoderSafeOrEqual​(Encoder encoderToApply,
                                                           Encoder previousEncoder)
        Checks if is previous encoder is already "safe", equal or equivalent
        Parameters:
        encoderToApply - the encoder to apply
        previousEncoder - the previous encoder
        Returns:
        true, if previous encoder is already "safe", equal or equivalent