public final class RFC2231Tools
extends java.lang.Object
RFC2231Tools - A collection of RFC2231 related utility
methods| Modifier and Type | Method and Description |
|---|---|
static boolean |
isAscii(char c)
Checks whether the character is ASCII 7 bit
|
static boolean |
isAscii(java.lang.String s)
Checks whether the specified string's characters are ASCII 7 bit
|
static java.lang.String[] |
parseRFC2231Value(java.lang.String rfc2231Value)
Parses given RFC2231 value into its charset, language and
rfc2231-encoded value.
|
static java.lang.String |
rfc2231Decode(java.lang.String encoded)
Decodes specified string according to mail-safe encoding introduced in RFC2231
This method assumes that encoding information are contained in given string; e.g.
|
static java.lang.String |
rfc2231Decode(java.lang.String encoded,
java.lang.String charset)
Decodes specified string according to mail-safe encoding introduced in RFC2231
|
static java.lang.String |
rfc2231Encode(java.lang.String toEncode,
java.lang.String charset,
java.lang.String language,
boolean prepend)
Encodes given string according to mechanism provided in RFC2231.
|
static java.lang.String |
rfc2231Encode(java.lang.String toEncode,
java.lang.String charset,
java.lang.String language,
boolean prepend,
boolean force)
Encodes given string according to mechanism provided in RFC2231.
|
public static java.lang.String[] parseRFC2231Value(java.lang.String rfc2231Value)
<charset-name> + "'" + <language-code> + "'" + <encoded-data>
rfc2231Value - The rfc2231 valueString containing charset, language, and rfc2231-encoded value or null if value does not
match pattern.public static java.lang.String rfc2231Decode(java.lang.String encoded)
This method assumes that encoding information are contained in given string; e.g.
utf-8'EN'%C2%A4%20txt
encoded - The encoded stringpublic static java.lang.String rfc2231Decode(java.lang.String encoded,
java.lang.String charset)
encoded - The encoded stringcharset - The charset namepublic static java.lang.String rfc2231Encode(java.lang.String toEncode,
java.lang.String charset,
java.lang.String language,
boolean prepend)
toEncode - The string to encodecharset - The charset encodinglanguage - The language to appendprepend - true to prepend charset and language information; otherwise falsepublic static java.lang.String rfc2231Encode(java.lang.String toEncode,
java.lang.String charset,
java.lang.String language,
boolean prepend,
boolean force)
toEncode - The string to encodecharset - The charset encodinglanguage - The language to appendprepend - true to prepend charset and language information; otherwise falseforce - true to force encoding even if string to encode only consists of ASCII characters; otherwise
falsepublic static boolean isAscii(java.lang.String s)
s - The string to checktrue if string's characters are ASCII 7 bit; otherwise falsepublic static boolean isAscii(char c)
c - The character to checktrue if character is ASCII 7 bit; otherwise false