Package com.helger.commons.codec
Class RFC1522QCodec
java.lang.Object
com.helger.commons.codec.AbstractRFC1522Codec
com.helger.commons.codec.RFC1522QCodec
Similar to the Quoted-Printable content-transfer-encoding defined in
RFC 1521 and designed to
allow text containing mostly ASCII characters to be decipherable on an ASCII
terminal without decoding.
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.
- See Also:
-
Field Summary
FieldsFields inherited from class com.helger.commons.codec.AbstractRFC1522Codec
POSTFIX, PREFIX, SEP -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor with the UTF-8 charset.RFC1522QCodec(Charset aCharset) Constructor which allows for the selection of a default charset. -
Method Summary
Modifier and TypeMethodDescriptionstatic BitSetprotected byte[]getDecoded(byte[] aEncodedBuffer, int nOfs, int nLen) protected byte[]getEncoded(byte[] aDecodedBuffer, int nOfs, int nLen) protected StringReturns the codec name (referred to as encoding in the RFC 1522).booleanTests if optional transformation of SPACE characters is to be usedvoidsetEncodeBlanks(boolean bEncodeBlanks) Defines whether optional transformation of SPACE characters is to be usedMethods inherited from class com.helger.commons.codec.AbstractRFC1522Codec
getCharset, getDecoded, getEncoded
-
Field Details
-
DEFAULT_ENCODE_BLANKS
public static final boolean DEFAULT_ENCODE_BLANKS- See Also:
-
-
Constructor Details
-
RFC1522QCodec
public RFC1522QCodec()Default constructor with the UTF-8 charset. -
RFC1522QCodec
Constructor which allows for the selection of a default charset.- Parameters:
aCharset- the default string charset to use.
-
-
Method Details
-
getAllPrintableChars
-
getRFC1522Encoding
Description copied from class:AbstractRFC1522CodecReturns the codec name (referred to as encoding in the RFC 1522).- Specified by:
getRFC1522Encodingin classAbstractRFC1522Codec- Returns:
- name of the codec
-
isEncodeBlanks
public boolean isEncodeBlanks()Tests if optional transformation of SPACE characters is to be used- Returns:
trueif SPACE characters are to be transformed,falseotherwise
-
setEncodeBlanks
public void setEncodeBlanks(boolean bEncodeBlanks) Defines whether optional transformation of SPACE characters is to be used- Parameters:
bEncodeBlanks-trueif SPACE characters are to be transformed,falseotherwise
-
getEncoded
@Nullable @ReturnsMutableCopy protected byte[] getEncoded(@Nullable byte[] aDecodedBuffer, @Nonnegative int nOfs, @Nonnegative int nLen) - Specified by:
getEncodedin classAbstractRFC1522Codec
-
getDecoded
@Nullable @ReturnsMutableCopy protected byte[] getDecoded(@Nullable byte[] aEncodedBuffer, @Nonnegative int nOfs, @Nonnegative int nLen) - Specified by:
getDecodedin classAbstractRFC1522Codec
-