public abstract class AbstractRFC1522Codec extends AbstractCodec implements IStringCodec
RFC 1522 describes techniques to allow the encoding of non-ASCII text in various portions of a RFC 822 [2] message header, in a manner which is unlikely to confuse existing message handling software.
This class is immutable and thread-safe.
| Modifier and Type | Field and Description |
|---|---|
protected static String |
POSTFIX
Prefix.
|
protected static String |
PREFIX
Postfix.
|
protected static char |
SEP
Separator.
|
| Constructor and Description |
|---|
AbstractRFC1522Codec() |
| Modifier and Type | Method and Description |
|---|---|
String |
decodeText(String sText)
Applies an RFC 1522 compliant decoding scheme to the given string of text.
|
protected String |
encodeText(String sText,
Charset aCharset)
Applies an RFC 1522 compliant encoding scheme to the given string of text
with the given charset.
|
protected abstract String |
getRFC1522Encoding()
Returns the codec name (referred to as encoding in the RFC 1522).
|
decode, encodeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitencodeText, getCharsetencodedecodeprotected static final char SEP
protected static final String POSTFIX
protected static final String PREFIX
@Nonnull @Nonempty protected abstract String getRFC1522Encoding()
@Nullable protected String encodeText(@Nullable String sText, @Nonnull Charset aCharset) throws EncoderException
This method constructs the "encoded-word" header common to all the RFC 1522
codecs and then invokes IByteArrayEncoder.encode(byte []) method of a concrete class
to perform the specific encoding.
sText - a string to encodeaCharset - a charset to be usedEncoderException - thrown if there is an error condition during the Encoding process.@Nullable public String decodeText(@Nullable String sText) throws DecoderException
This method processes the "encoded-word" header common to all the RFC 1522
codecs and then invokes IByteArrayDecoder.decode(byte []) method of a concrete class
to perform the specific decoding.
decodeText in interface IStringCodecsText - a string to decodenull if the input is null.DecoderException - thrown if there is an error condition during the decoding process.Copyright © 2006–2015 phloc systems. All rights reserved.