public class RFC1522QCodec extends AbstractRFC1522Codec
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 conditionally thread-safe. The instance field m_bEncodeBlanks
is mutable setEncodeBlanks(boolean) but is not volatile, and
accesses are not synchronised. If an instance of the class is shared between
threads, the caller needs to ensure that suitable synchronisation is used to
ensure safe publication of the value between threads, and must not invoke
setEncodeBlanks(boolean) after initial setup.
| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEFAULT_ENCODE_BLANKS |
POSTFIX, PREFIX, SEP| Constructor and Description |
|---|
RFC1522QCodec()
Default constructor with the UTF-8 charset.
|
RFC1522QCodec(Charset aCharset)
Constructor which allows for the selection of a default charset.
|
| Modifier and Type | Method and Description |
|---|---|
Charset |
getCharset() |
byte[] |
getDecoded(byte[] aBuffer)
Decode a byte array.
|
String |
getDecodedText(String sText)
Decodes a quoted-printable string into its original form.
|
byte[] |
getEncoded(byte[] aBuffer)
Encode a byte array.
|
String |
getEncodedText(String sText)
Encodes a string into its quoted-printable form using the default charset.
|
protected String |
getRFC1522Encoding()
Returns the codec name (referred to as encoding in the RFC 1522).
|
boolean |
isEncodeBlanks()
Tests if optional transformation of SPACE characters is to be used
|
void |
setEncodeBlanks(boolean bEncodeBlanks)
Defines whether optional transformation of SPACE characters is to be used
|
getEncodedTextgetEncodedgetDecodedclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetDecodedpublic static final boolean DEFAULT_ENCODE_BLANKS
protected String getRFC1522Encoding()
AbstractRFC1522CodecgetRFC1522Encoding in class AbstractRFC1522Codecpublic boolean isEncodeBlanks()
true if SPACE characters are to be transformed,
false otherwisepublic void setEncodeBlanks(boolean bEncodeBlanks)
bEncodeBlanks - true if SPACE characters are to be transformed,
false otherwise@Nullable @ReturnsMutableCopy public byte[] getEncoded(@Nullable byte[] aBuffer)
IByteArrayEncoderaBuffer - The byte array to be encoded. May be null.null if the parameter was
null.@Nullable @ReturnsMutableCopy public byte[] getDecoded(@Nullable byte[] aBuffer) throws DecodeException
IByteArrayDecoderaBuffer - The byte array to be decoded. May not be null.null if the parameter was
null.DecodeException - in case something goes wrong@Nullable public String getEncodedText(@Nullable String sText) throws EncodeException
sText - string to convert to quoted-printable formEncodeException - thrown if a failure condition is encountered during the encoding
process.@Nullable public String getDecodedText(@Nullable String sText) throws DecodeException
getDecodedText in class AbstractRFC1522CodecsText - quoted-printable string to convert into its original formDecodeException - A decoder exception is thrown if a failure condition is encountered
during the decode process.Copyright © 2014–2015 Philip Helger. All rights reserved.