public abstract class AbstractRFC1522Codec extends AbstractByteArrayCodec
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
Postfix.
|
protected static String |
PREFIX
Prefix.
|
protected static char |
SEP
Separator.
|
| Constructor and Description |
|---|
AbstractRFC1522Codec() |
| Modifier and Type | Method and Description |
|---|---|
String |
getDecodedText(String sEncodedText)
Applies an RFC 1522 compliant decoding scheme to the given string of text.
|
protected String |
getEncodedText(String sText,
Charset aSourceCharset)
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).
|
getEncodedgetDecodedclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetEncodedgetDecoded, getDecodedprotected static final char SEP
protected static final String PREFIX
protected static final String POSTFIX
@Nonnull @Nonempty protected abstract String getRFC1522Encoding()
@Nullable protected String getEncodedText(@Nullable String sText, @Nonnull Charset aSourceCharset) throws EncodeException
This method constructs the "encoded-word" header common to all the RFC 1522
codecs and then invokes IByteArrayEncoder.getEncoded(byte []) method of a concrete
class to perform the specific encoding.
sText - a string to encodeaSourceCharset - a charset to be usedEncodeException - thrown if there is an error condition during the Encoding process.@Nullable public String getDecodedText(@Nullable String sEncodedText) throws DecodeException
This method processes the "encoded-word" header common to all the RFC 1522
codecs and then invokes IByteArrayDecoder.getDecoded(byte []) method of a concrete
class to perform the specific decoding.
sEncodedText - a string to decodenull if the input is null.DecodeException - thrown if there is an error condition during the decoding process.Copyright © 2014–2015 Philip Helger. All rights reserved.