|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.mail.internet.MimeUtility
public class MimeUtility
This is a utility class providing micellaneous MIME-related functionality.
Field Summary | |
---|---|
static int |
ALL
|
Method Summary | |
---|---|
static InputStream |
decode(InputStream is,
String encoding)
Decodes the given input stream. |
static String |
decodeText(String etext)
Decodes headers that are defined as '*text' in RFC 822. |
static String |
decodeWord(String text)
Decodes the specified string using the RFC 2047 rules for parsing an "encoded-word". |
static OutputStream |
encode(OutputStream os,
String encoding)
Encodes the given output stream. |
static OutputStream |
encode(OutputStream os,
String encoding,
String filename)
Encodes the given output stream. |
static String |
encodeText(String text)
Encodes an RFC 822 "text" token into mail-safe form according to RFC 2047. |
static String |
encodeText(String text,
String charset,
String encoding)
Encodes an RFC 822 "text" token into mail-safe form according to RFC 2047. |
static String |
encodeWord(String text)
Encodes an RFC 822 "word" token into mail-safe form according to RFC 2047. |
static String |
encodeWord(String text,
String charset,
String encoding)
Encodes an RFC 822 "word" token into mail-safe form according to RFC 2047. |
static String |
fold(int used,
String s)
Folds the specified string such that each line is no longer than 76 characters, whitespace permitting. |
static String |
getDefaultJavaCharset()
Returns the default Java charset. |
static String |
getEncoding(DataHandler dh)
Returns the Content-Transfer-Encoding that needs to be applied to the given content in order to make it mail safe. |
static String |
getEncoding(DataSource ds)
Returns the Content-Transfer-Encoding that should be applied to the input stream of this data source, to make it mail safe. |
static String |
javaCharset(String charset)
Converts a MIME charset name into a Java charset name. |
static String |
mimeCharset(String charset)
Converts a Java charset name into a MIME charset name. |
static String |
quote(String text,
String specials)
Quotes the specified word, if it contains any characters from the given "specials" list. |
static String |
unfold(String s)
Unfolds a folded header. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int ALL
Method Detail |
---|
public static String getEncoding(DataSource ds)
ds
- the data source
public static String getEncoding(DataHandler dh)
getEncoding(DataSource)
method
except that instead of reading the data from an input stream it uses
the writeTo
method to examine the data, which can be more
efficient.
public static InputStream decode(InputStream is, String encoding) throws MessagingException
is
- the input streamencoding
- the encoding
MessagingException
public static OutputStream encode(OutputStream os, String encoding) throws MessagingException
os
- the output streamencoding
- the encoding
MessagingException
public static OutputStream encode(OutputStream os, String encoding, String filename) throws MessagingException
os
- the output streamencoding
- the encodingfilename
- the name for the file being encoded (this is only used
with the uuencode encoding)
MessagingException
public static String encodeText(String text) throws UnsupportedEncodingException
text
- the Unicode stringUnsupportedEncodingException
- if the encoding fails
UnsupportedEncodingException
public static String encodeText(String text, String charset, String encoding) throws UnsupportedEncodingException
text
- the Unicode stringcharset
- the charset, or null to use the platform default charsetencoding
- the encoding to be used ("B" or "Q")
UnsupportedEncodingException
public static String decodeText(String etext) throws UnsupportedEncodingException
etext
- the possibly encoded value
UnsupportedEncodingException
- if the charset conversion failedpublic static String encodeWord(String text) throws UnsupportedEncodingException
text
- the Unicode string
UnsupportedEncodingException
- if the encoding failspublic static String encodeWord(String text, String charset, String encoding) throws UnsupportedEncodingException
text
- the Unicode stringcharset
- the charset, or null to use the platform default charsetencoding
- the encoding to be used ("B" or "Q")
UnsupportedEncodingException
- if the encoding failspublic static String decodeWord(String text) throws ParseException, UnsupportedEncodingException
eword
- the possibly encoded value
ParseException
- if the string is not an encoded-word
UnsupportedEncodingException
- if the decoding failedpublic static String quote(String text, String specials)
The HeaderTokenizer class defines two "specials" lists, MIME and RFC 822.
word
- the word to be quotedspecials
- the set of special characterspublic static String javaCharset(String charset)
charset
- the MIME charset namepublic static String mimeCharset(String charset)
charset
- the Java charset namepublic static String getDefaultJavaCharset()
public static String fold(int used, String s)
used
- the number of characters used in the line alreadys
- the string to foldpublic static String unfold(String s)
s
- the header to unfold
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |