Class AbstractRFC1522Codec

    • Constructor Detail

      • AbstractRFC1522Codec

        protected AbstractRFC1522Codec​(@Nonnull
                                       Charset aCharset)
        Constructor which allows for the selection of a default charset
        Parameters:
        aCharset - the default string charset to use.
    • Method Detail

      • getRFC1522Encoding

        @Nonnull
        @Nonempty
        protected abstract String getRFC1522Encoding()
        Returns the codec name (referred to as encoding in the RFC 1522).
        Returns:
        name of the codec
      • getEncoded

        @Nullable
        public String getEncoded​(@Nullable
                                 String sText)
        Applies an RFC 1522 compliant encoding scheme to the given string of text with the given charset.

        This method constructs the "encoded-word" header common to all the RFC 1522 codecs and then invokes #getEncoded(byte []) method of a concrete class to perform the specific encoding.

        Specified by:
        getEncoded in interface IEncoder<String,​String>
        Parameters:
        sText - a string to encode
        Returns:
        RFC 1522 compliant "encoded-word"
        Throws:
        EncodeException - thrown if there is an error condition during the Encoding process.
        See Also:
        Standard charsets
      • getDecoded

        @Nullable
        public String getDecoded​(@Nullable
                                 String sEncodedText)
        Applies an RFC 1522 compliant decoding scheme to the given string of text.

        This method processes the "encoded-word" header common to all the RFC 1522 codecs and then invokes #getDecoded(byte []) method of a concrete class to perform the specific decoding.

        Specified by:
        getDecoded in interface IDecoder<String,​String>
        Parameters:
        sEncodedText - a string to decode
        Returns:
        A new decoded String or null if the input is null.
        Throws:
        DecodeException - thrown if there is an error condition during the decoding process.