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 |
|---|---|
byte[] |
decode(byte[] aBuffer)
Decode a byte array.
|
String |
decodeText(String sText)
Decodes a quoted-printable string into its original form.
|
byte[] |
encode(byte[] aBuffer)
Encode a byte array.
|
String |
encodeText(String sText)
Encodes a string into its quoted-printable form using the default charset.
|
Charset |
getCharset()
Gets the default charset name used for string decoding and encoding.
|
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
|
encodeTextdecode, encodepublic static final boolean DEFAULT_ENCODE_BLANKS
protected String getRFC1522Encoding()
AbstractRFC1522CodecgetRFC1522Encoding in class AbstractRFC1522Codec@Nonnull public Charset getCharset()
IStringCodecnull.public 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 public byte[] encode(@Nullable byte[] aBuffer)
IByteArrayEncoderaBuffer - The byte array to be encoded. May be null.null if the parameter was
null.@Nullable public byte[] decode(@Nullable byte[] aBuffer) throws DecoderException
IByteArrayDecoderaBuffer - The byte array to be decoded. May not be null.null if the parameter was
null.DecoderException - in case something goes wrong@Nullable public String encodeText(@Nullable String sText) throws EncoderException
sText - string to convert to quoted-printable formEncoderException - thrown if a failure condition is encountered during the encoding
process.@Nullable public String decodeText(@Nullable String sText) throws DecoderException
decodeText in interface IStringCodecdecodeText in class AbstractRFC1522CodecsText - quoted-printable string to convert into its original formDecoderException - A decoder exception is thrown if a failure condition is encountered
during the decode process.Copyright © 2006–2015 phloc systems. All rights reserved.