Methods Summary |
---|
public java.lang.Object | decode(java.lang.Object pObject)Decodes a quoted-printable object into its original form. Escaped characters are converted back to their original
representation.
if (pObject == null) {
return null;
} else if (pObject instanceof String) {
return decode((String) pObject);
} else {
throw new DecoderException("Objects of type "
+ pObject.getClass().getName()
+ " cannot be decoded using Q codec");
}
|
public java.lang.String | decode(java.lang.String pString)Decodes a quoted-printable string into its original form. Escaped characters are converted back to their original
representation.
if (pString == null) {
return null;
}
try {
return decodeText(pString);
} catch (UnsupportedEncodingException e) {
throw new DecoderException(e.getMessage());
}
|
protected byte[] | doDecoding(byte[] bytes)
if (bytes == null) {
return null;
}
boolean hasUnderscores = false;
for (int i = 0; i < bytes.length; i++) {
if (bytes[i] == UNDERSCORE) {
hasUnderscores = true;
break;
}
}
if (hasUnderscores) {
byte[] tmp = new byte[bytes.length];
for (int i = 0; i < bytes.length; i++) {
byte b = bytes[i];
if (b != UNDERSCORE) {
tmp[i] = b;
} else {
tmp[i] = BLANK;
}
}
return QuotedPrintableCodec.decodeQuotedPrintable(tmp);
}
return QuotedPrintableCodec.decodeQuotedPrintable(bytes);
|
protected byte[] | doEncoding(byte[] bytes)
if (bytes == null) {
return null;
}
byte[] data = QuotedPrintableCodec.encodeQuotedPrintable(PRINTABLE_CHARS, bytes);
if (this.encodeBlanks) {
for (int i = 0; i < data.length; i++) {
if (data[i] == BLANK) {
data[i] = UNDERSCORE;
}
}
}
return data;
|
public java.lang.String | encode(java.lang.String pString, java.lang.String charset)Encodes a string into its quoted-printable form using the specified charset. Unsafe characters are escaped.
if (pString == null) {
return null;
}
try {
return encodeText(pString, charset);
} catch (UnsupportedEncodingException e) {
throw new EncoderException(e.getMessage());
}
|
public java.lang.String | encode(java.lang.String pString)Encodes a string into its quoted-printable form using the default charset. Unsafe characters are escaped.
if (pString == null) {
return null;
}
return encode(pString, getDefaultCharset());
|
public java.lang.Object | encode(java.lang.Object pObject)Encodes an object into its quoted-printable form using the default charset. Unsafe characters are escaped.
if (pObject == null) {
return null;
} else if (pObject instanceof String) {
return encode((String) pObject);
} else {
throw new EncoderException("Objects of type "
+ pObject.getClass().getName()
+ " cannot be encoded using Q codec");
}
|
public java.lang.String | getDefaultCharset()The default charset used for string decoding and encoding.
return this.charset;
|
protected java.lang.String | getEncoding()
return "Q";
|
public boolean | isEncodeBlanks()Tests if optional tranformation of SPACE characters is to be used
return this.encodeBlanks;
|
public void | setEncodeBlanks(boolean b)Defines whether optional tranformation of SPACE characters is to be used
this.encodeBlanks = b;
|