Package com.helger.commons.codec
Class RFC1522QCodec
- java.lang.Object
-
- com.helger.commons.codec.AbstractRFC1522Codec
-
- com.helger.commons.codec.RFC1522QCodec
-
public class RFC1522QCodec extends AbstractRFC1522Codec
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 invokesetEncodeBlanks(boolean)after initial setup.
-
-
Field Summary
Fields Modifier and Type Field Description static booleanDEFAULT_ENCODE_BLANKS-
Fields inherited from class com.helger.commons.codec.AbstractRFC1522Codec
POSTFIX, PREFIX, SEP
-
-
Constructor Summary
Constructors Constructor Description RFC1522QCodec()Default constructor with the UTF-8 charset.RFC1522QCodec(Charset aCharset)Constructor which allows for the selection of a default charset.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static BitSetgetAllPrintableChars()protected byte[]getDecoded(byte[] aEncodedBuffer, int nOfs, int nLen)protected byte[]getEncoded(byte[] aDecodedBuffer, int nOfs, int nLen)protected StringgetRFC1522Encoding()Returns the codec name (referred to as encoding in the RFC 1522).booleanisEncodeBlanks()Tests if optional transformation of SPACE characters is to be usedvoidsetEncodeBlanks(boolean bEncodeBlanks)Defines whether optional transformation of SPACE characters is to be used-
Methods inherited from class com.helger.commons.codec.AbstractRFC1522Codec
getCharset, getDecoded, getEncoded
-
-
-
-
Field Detail
-
DEFAULT_ENCODE_BLANKS
public static final boolean DEFAULT_ENCODE_BLANKS
- See Also:
- Constant Field Values
-
-
Method Detail
-
getAllPrintableChars
@Nonnull @ReturnsMutableCopy public static BitSet getAllPrintableChars()
-
getRFC1522Encoding
protected String 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
-
-