<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<!-- Generated by javadoc (build 1.6.0_10) on Tue Nov 17 12:13:40 PST 2009 -->
<
META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
MimeUtility (JavaMail API documentation)
<
META NAME="date" CONTENT="2009-11-17">
<
LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
<
SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="MimeUtility (JavaMail API documentation)";
}
}
<
BODY BGCOLOR="white" onload="windowTitle();">
<!-- ========= START OF TOP NAVBAR ======= -->
<
A NAME="navbar_top"><!-- --><
/A>
<
A HREF="#skip-navbar_top" title="Skip navigation links"><
/A>
<
TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<
TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<
A NAME="navbar_top_firstrow"><!-- --><
/A>
<
TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<
TR ALIGN="center" VALIGN="top">
<
TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <
A HREF="../../../overview-summary.html"><
FONT CLASS="NavBarFont1"><
B>Overview<
/B><
/FONT><
/A> <
/TD>
<
TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <
A HREF="package-summary.html"><
FONT CLASS="NavBarFont1"><
B>Package<
/B><
/FONT><
/A> <
/TD>
<
TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <
FONT CLASS="NavBarFont1Rev"><
B>Class<
/B><
/FONT> <
/TD>
<
TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <
A HREF="class-use/MimeUtility.html"><
FONT CLASS="NavBarFont1"><
B>Use<
/B><
/FONT><
/A> <
/TD>
<
TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <
A HREF="package-tree.html"><
FONT CLASS="NavBarFont1"><
B>Tree<
/B><
/FONT><
/A> <
/TD>
<
TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <
A HREF="../../../deprecated-list.html"><
FONT CLASS="NavBarFont1"><
B>Deprecated<
/B><
/FONT><
/A> <
/TD>
<
TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <
A HREF="../../../index-files/index-1.html"><
FONT CLASS="NavBarFont1"><
B>Index<
/B><
/FONT><
/A> <
/TD>
<
TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <
A HREF="../../../help-doc.html"><
FONT CLASS="NavBarFont1"><
B>Help<
/B><
/FONT><
/A> <
/TD>
<
TD ALIGN="right" VALIGN="top" ROWSPAN=3><
EM>
<
TD BGCOLOR="white" CLASS="NavBarCell2"><
FONT SIZE="-2">
<
A HREF="../../../javax/mail/internet/MimePartDataSource.html" title="class in javax.mail.internet"><
B>PREV CLASS<
/B><
/A>
<
A HREF="../../../javax/mail/internet/NewsAddress.html" title="class in javax.mail.internet"><
B>NEXT CLASS<
/B><
/A><
/FONT><
/TD>
<
TD BGCOLOR="white" CLASS="NavBarCell2"><
FONT SIZE="-2">
<
A HREF="../../../index.html?javax/mail/internet/MimeUtility.html" target="_top"><
B>FRAMES<
/B><
/A>
<
A HREF="MimeUtility.html" target="_top"><
B>NO FRAMES<
/B><
/A>
<
SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
<
A HREF="../../../allclasses-noframe.html"><
B>All Classes<
/B><
/A>
<
TD VALIGN="top" CLASS="NavBarCell3"><
FONT SIZE="-2">
SUMMARY: NESTED | <
A HREF="#field_summary">FIELD<
/A> | CONSTR | <
A HREF="#method_summary">METHOD<
/A><
/FONT><
/TD>
<
TD VALIGN="top" CLASS="NavBarCell3"><
FONT SIZE="-2">
DETAIL: <
A HREF="#field_detail">FIELD<
/A> | CONSTR | <
A HREF="#method_detail">METHOD<
/A><
/FONT><
/TD>
<
A NAME="skip-navbar_top"><
/A>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
javax.mail.internet<
/FONT>
<
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.
lang.Object<
/A>
<
IMG SRC="../../../resources/inherit.gif" ALT="extended by "><
B>javax.mail.internet.MimeUtility<
/B>
<
DT><
PRE>public
class <
B>MimeUtility<
/B><
DT>extends <
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object<
/A><
/DL>
This is a utility class that provides various MIME related
There are a set of methods to encode and decode MIME headers as
per RFC 2047. Note that, in general, these methods are
will automatically encode and decode data when using these "higher
level" methods. The methods below are only needed when maniuplating
methods. A brief description on handling such
headers is given below: <
p>
RFC
822 mail
headers <
strong>must<
/strong> contain only US-ASCII
characters. Headers that contain non US-ASCII characters must be
encoded so that they contain only US-ASCII characters. Basically,
this process involves using either BASE64 or QP to encode certain
characters. RFC
2047 describes this in detail. <
p>
In Java, Strings contain (16 bit) Unicode characters. ASCII is a
subset of Unicode (and occupies the range 0 - 127). A String
that contains only ASCII characters is already mail-safe. If the
String contains non US-ASCII characters, it must be encoded. An
additional complexity in this step is that since Unicode is not
yet a widely used charset, one might want to first charset-encode
the String into another charset and then do the transfer-encoding.
Note that to get the actual bytes of a mail-safe String (say,
for sending over SMTP), one must do
byte[] bytes = string.getBytes("iso-8859-1");
on MimeMessage and MimeBodyPart assume that the given header values
are Unicode strings that contain only US-ASCII characters. Hence
the callers of those methods must insure that the values they pass
do not contain non US-ASCII characters. The methods in this class
The <
code>getHeader<
/code> family of methods on MimeMessage and
MimeBodyPart return the raw header value. These might be encoded
as per RFC 2047, and if so, must be decoded into Unicode Strings.
The methods in this
class help to do this. <
p>
Several System properties control strict conformance to the MIME
spec. Note that these are not session properties but must be set
globally as System properties. <
p>
The <
code>mail.mime.decodetext.strict<
/code> property controls
decoding of MIME encoded words. The MIME spec requires that encoded
words start at the beginning of a whitespace separated word. Some
mailers incorrectly include encoded words in the middle of a word.
If the <
code>mail.mime.decodetext.strict<
/code> System property is
set to <
code>
"false"<
/code>, an attempt will be made to decode these
illegal encoded words. The default is true. <
p>
The <
code>mail.mime.encodeeol.strict<
/code> property controls the
choice of Content-Transfer-Encoding for MIME parts that are not of
type "text". Often such parts will contain textual data for which
an encoding that allows normal end of line conventions is appropriate.
In rare cases, such a part will appear to contain entirely textual
data, but will require an encoding that preserves CR and LF characters
without change. If the <
code>mail.mime.encodeeol.strict<
/code>
System property is set to <
code>
"true"<
/code>, such an encoding will
be used when necessary. The default is false. <
p>
In addition, the <
code>mail.mime.charset<
/code> System property can
be used to specify the default MIME charset to use for encoded words
and text parts that don't otherwise specify a charset. Normally, the
default MIME charset is derived from the default Java charset, as
specified in the <code>file.encoding</code> System property. Most
applications will have no need to explicitly set the default MIME
charset. In cases where the default MIME charset to be used for
mail messages is different than the charset used for files stored on
the system, this property should be set. <p>
The current implementation also supports the following System property.
<p>
The <code>mail.mime.ignoreunknownencoding</code> property controls
whether unknown values in the <code>Content-Transfer-Encoding</code>
header, as passed to the <code>decode</code> method, cause an exception.
If set to <code>"true"</code>, unknown values are ignored and 8bit
encoding is assumed. Otherwise, unknown values cause a MessagingException
to be thrown.
<P>
<P>
<HR>
<P>
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Field Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/mail/internet/MimeUtility.html#ALL">ALL</A></B></CODE>
<BR>
</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/mail/internet/MimeUtility.html#decode(java.io.InputStream, java.lang.String)">decode</A></B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A> is,
<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> encoding)</CODE>
<BR>
Decode the given input stream.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/mail/internet/MimeUtility.html#decodeText(java.lang.String)">decodeText</A></B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> etext)</CODE>
<BR>
Decode "unstructured" headers, that is, headers that are defined
as '*text' as per RFC 822.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/mail/internet/MimeUtility.html#decodeWord(java.lang.String)">decodeWord</A></B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> eword)</CODE>
<BR>
The string is parsed using the rules in RFC 2047 and RFC 2231 for
parsing an "encoded-word".</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/mail/internet/MimeUtility.html#encode(java.io.OutputStream, java.lang.String)">encode</A></B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</A> os,
<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> encoding)</CODE>
<BR>
Wrap an encoder around the given output stream.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/mail/internet/MimeUtility.html#encode(java.io.OutputStream, java.lang.String, java.lang.String)">encode</A></B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</A> os,
<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> encoding,
<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> filename)</CODE>
<BR>
Wrap an encoder around the given output stream.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/mail/internet/MimeUtility.html#encodeText(java.lang.String)">encodeText</A></B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> text)</CODE>
<BR>
Encode a RFC 822 "text" token into mail-safe form as per
RFC 2047.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/mail/internet/MimeUtility.html#encodeText(java.lang.String, java.lang.String, java.lang.String)">encodeText</A></B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> text,
<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> charset,
<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> encoding)</CODE>
<BR>
Encode a RFC 822 "text" token into mail-safe form as per
RFC 2047.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/mail/internet/MimeUtility.html#encodeWord(java.lang.String)">encodeWord</A></B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> word)</CODE>
<BR>
Encode a RFC 822 "word" token into mail-safe form as per
RFC 2047.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/mail/internet/MimeUtility.html#encodeWord(java.lang.String, java.lang.String, java.lang.String)">encodeWord</A></B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> word,
<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> charset,
<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> encoding)</CODE>
<BR>
Encode a RFC 822 "word" token into mail-safe form as per
RFC 2047.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/mail/internet/MimeUtility.html#fold(int, java.lang.String)">fold</A></B>(int used,
<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> s)</CODE>
<BR>
Fold a string at linear whitespace so that each line is no longer
than 76 characters, if possible.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/mail/internet/MimeUtility.html#getDefaultJavaCharset()">getDefaultJavaCharset</A></B>()</CODE>
<BR>
Get the default charset corresponding to the system's current
<
TR BGCOLOR="white" CLASS="TableRowColor">
<
TD ALIGN="right" VALIGN="top" WIDTH="1%"><
FONT SIZE="-1">
<
CODE>static <
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String<
/A><
/CODE><
/FONT><
/TD>
<
TD><
CODE><
B><
A HREF="../../../javax/mail/internet/MimeUtility.html#getEncoding(javax.activation.DataHandler)">getEncoding<
/A><
/B>
(<
A HREF="http://java.sun.com/javase/technologies/desktop/javabeans/glasgow/javadocs/javax/activation/DataHandler.html?is-external=true" title="class or interface in javax.activation">DataHandler<
/A> dh
)<
/CODE>
Same as <
code>getEncoding
(DataSource
)<
/code> except that instead
of reading the
data from an <
code>InputStream<
/code> it uses the
<
code>writeTo<
/code>
method to examine the
data.<
/TD>
<
TR BGCOLOR="white" CLASS="TableRowColor">
<
TD ALIGN="right" VALIGN="top" WIDTH="1%"><
FONT SIZE="-1">
<
CODE>static <
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String<
/A><
/CODE><
/FONT><
/TD>
<
TD><
CODE><
B><
A HREF="../../../javax/mail/internet/MimeUtility.html#getEncoding(javax.activation.DataSource)">getEncoding<
/A><
/B>
(<
A HREF="http://java.sun.com/javase/technologies/desktop/javabeans/glasgow/javadocs/javax/activation/DataSource.html?is-external=true" title="class or interface in javax.activation">DataSource<
/A> ds
)<
/CODE>
Get the content-transfer-encoding that should be applied
to the input stream of this datasource, to make it mailsafe.<
/TD>
<
TR BGCOLOR="white" CLASS="TableRowColor">
<
TD ALIGN="right" VALIGN="top" WIDTH="1%"><
FONT SIZE="-1">
<
CODE>static <
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String<
/A><
/CODE><
/FONT><
/TD>
<
TD><
CODE><
B><
A HREF="../../../javax/mail/internet/MimeUtility.html#javaCharset(java.lang.String)">javaCharset<
/A><
/B>
(<
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String<
/A>
charset)<
/CODE>
Convert a MIME
charset name into a valid Java
charset name.<
/TD>
<
TR BGCOLOR="white" CLASS="TableRowColor">
<
TD ALIGN="right" VALIGN="top" WIDTH="1%"><
FONT SIZE="-1">
<
CODE>static <
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String<
/A><
/CODE><
/FONT><
/TD>
<
TD><
CODE><
B><
A HREF="../../../javax/mail/internet/MimeUtility.html#mimeCharset(java.lang.String)">mimeCharset<
/A><
/B>
(<
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String<
/A>
charset)<
/CODE>
Convert a java
charset into its MIME
charset name.<
/TD>
<
TR BGCOLOR="white" CLASS="TableRowColor">
<
TD ALIGN="right" VALIGN="top" WIDTH="1%"><
FONT SIZE="-1">
<
CODE>static <
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String<
/A><
/CODE><
/FONT><
/TD>
<
TD><
CODE><
B><
A HREF="../../../javax/mail/internet/MimeUtility.html#quote(java.lang.String, java.lang.String)">quote<
/A><
/B>
(<
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String<
/A> word,
<
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String<
/A> specials
)<
/CODE>
A utility method to quote a word, if the word contains any
characters from the specified
'specials' list.<
/TD>
<
TR BGCOLOR="white" CLASS="TableRowColor">
<
TD ALIGN="right" VALIGN="top" WIDTH="1%"><
FONT SIZE="-1">
<
CODE>static <
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String<
/A><
/CODE><
/FONT><
/TD>
<
TD><
CODE><
B><
A HREF="../../../javax/mail/internet/MimeUtility.html#unfold(java.lang.String)">unfold<
/A><
/B>
(<
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String<
/A> s
)<
/CODE>
Unfold a folded header.<
/TD>
<
A NAME="methods_inherited_from_class_java.lang.Object"><!-- --><
/A>
<
TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<
TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<
TH ALIGN="left"><
B>Methods inherited from
class java.
lang.<
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object<
/A><
/B><
/TH>
<
TR BGCOLOR="white" CLASS="TableRowColor">
<
TD><
CODE><
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone<
/A>, <
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals<
/A>, <
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize<
/A>, <
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass<
/A>, <
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode<
/A>, <
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify<
/A>, <
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll<
/A>, <
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString<
/A>, <
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait<
/A>, <
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait<
/A>, <
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait<
/A><
/CODE><
/TD>
<!-- ============ FIELD DETAIL =========== -->
<
A NAME="field_detail"><!-- --><
/A>
<
TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<
TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<
TH ALIGN="left" COLSPAN="1"><
FONT SIZE="+2">
<
A NAME="ALL"><!-- --><
/A><
H3>
public static final int <
B>ALL<
/B><
/PRE>
<
DT><
B>See Also:<
/B><
DD><
A HREF="../../../constant-values.html#javax.mail.internet.MimeUtility.ALL">Constant Field Values<
/A><
/DL>
<!-- ============ METHOD DETAIL ========== -->
<
A NAME="method_detail"><!-- --><
/A>
<
TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<
TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<
TH ALIGN="left" COLSPAN="1"><
FONT SIZE="+2">
<
A NAME="getEncoding(javax.activation.DataSource)"><!-- --><
/A><
H3>
public static <
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String<
/A> <
B>getEncoding<
/B>
(<
A HREF="http://java.sun.com/javase/technologies/desktop/javabeans/glasgow/javadocs/javax/activation/DataSource.html?is-external=true" title="class or interface in javax.activation">DataSource<
/A> ds
)<
/PRE>
<
DD>Get the content-transfer-encoding that should be applied
to the input stream of this datasource, to make it mailsafe. <
p>
The algorithm used here is: <
br>
If the primary type of this datasource is "text" and if all
the bytes in its input stream are US-ASCII, then the encoding
is "7bit". If more than half of the bytes are non-US-ASCII, then
the encoding is "base64". If less than half of the bytes are
non-US-ASCII, then the encoding is "quoted-printable".
If the primary type of this datasource is not "text", then if
all the bytes of its input stream are US-ASCII, the encoding
is "7bit". If there is even one non-US-ASCII character, the
encoding is "base64".
<
DT><
B>Returns:<
/B><
DD>the encoding. This is either
"7bit",
"quoted-printable" or
"base64"<
/DL>
<
A NAME="getEncoding(javax.activation.DataHandler)"><!-- --><
/A><
H3>
public static <
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String<
/A> <
B>getEncoding<
/B>
(<
A HREF="http://java.sun.com/javase/technologies/desktop/javabeans/glasgow/javadocs/javax/activation/DataHandler.html?is-external=true" title="class or interface in javax.activation">DataHandler<
/A> dh
)<
/PRE>
<
DD>Same as <
code>getEncoding
(DataSource
)<
/code> except that instead
of reading the
data from an <
code>InputStream<
/code> it uses the
<
code>writeTo<
/code>
method to examine the
data. This is more
efficient in the common case of a <
code>DataHandler<
/code>
created with an object and a MIME type (for example, a
"text/plain" String) because all the I/O is done in this
thread. In the case requiring an <
code>InputStream<
/code> the
<
code>DataHandler<
/code> uses a thread, a pair of pipe streams,
and the <
code>writeTo<
/code>
method to produce the
data. <
p>
<
A NAME="decode(java.io.InputStream, java.lang.String)"><!-- --><
/A><
H3>
public static <
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream<
/A> <
B>decode<
/B>
(<
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream<
/A> is,
<
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String<
/A> encoding
)
throws <
A HREF="../../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException<
/A><
/PRE>
<
DD>Decode the given input stream. The Input stream returned is
the decoded input stream. All the encodings defined in RFC 2045
are supported here. They include "base64", "quoted-printable",
"7bit", "8bit", and "binary". In addition, "uuencode" is also
In the current implementation, if the
<
code>mail.mime.ignoreunknownencoding<
/code> system property is set to
<
code>
"true"<
/code>, unknown encoding values are ignored and the
original InputStream is returned.
<
DT><
B>Returns:<
/B><
DD>decoded input stream.
<
DD><
CODE><
A HREF="../../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException<
/A><
/CODE> - if the encoding is unknown<
/DL>
<
A NAME="encode(java.io.OutputStream, java.lang.String)"><!-- --><
/A><
H3>
public static <
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream<
/A> <
B>encode<
/B>
(<
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream<
/A> os,
<
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String<
/A> encoding
)
throws <
A HREF="../../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException<
/A><
/PRE>
<
DD>Wrap an encoder around the given output stream.
All the encodings defined in RFC 2045 are supported here.
They include "base64", "quoted-printable", "7bit", "8bit" and
"binary". In addition, "uuencode" is also supported.
<
DT><
B>Returns:<
/B><
DD>output stream that applies the
specified encoding.
<
DD><
CODE><
A HREF="../../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException<
/A><
/CODE> - if the encoding is unknown<
/DL>
<
A NAME="encode(java.io.OutputStream, java.lang.String, java.lang.String)"><!-- --><
/A><
H3>
public static <
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream<
/A> <
B>encode<
/B>
(<
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream<
/A> os,
<
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String<
/A> encoding,
<
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String<
/A> filename
)
throws <
A HREF="../../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException<
/A><
/PRE>
<
DD>Wrap an encoder around the given output stream.
All the encodings defined in RFC 2045 are supported here.
They include "base64", "quoted-printable", "7bit", "8bit" and
"binary". In addition, "uuencode" is also supported.
The <
code>filename<
/code> parameter is used with the
"uuencode"
encoding and is included in the encoded output.
<
DT><
B>Parameters:<
/B><
DD><
CODE>os<
/CODE> - output stream<
DD><
CODE>encoding<
/CODE> - the encoding of the stream.<
DD><
CODE>filename<
/CODE> -
name for the file being encoded
(only used
with uuencode)
<
DT><
B>Returns:<
/B><
DD>output stream that applies the
specified encoding.
<
DD><
CODE><
A HREF="../../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException<
/A><
/CODE><
DT><
B>Since:<
/B><
/DT>
<
A NAME="encodeText(java.lang.String)"><!-- --><
/A><
H3>
public static <
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String<
/A> <
B>encodeText<
/B>
(<
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String<
/A>
text)
throws <
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/UnsupportedEncodingException.html?is-external=true" title="class or interface in java.io">UnsupportedEncodingException<
/A><
/PRE>
<
DD>Encode a RFC
822 "text" token into mail-safe form as per
The given Unicode string is examined for non US-ASCII
characters. If the string contains only US-ASCII characters,
it is returned as-is. If the string contains non US-ASCII
characters, it is first character-encoded using the platform's
default charset, then transfer-encoded using either the B or
Q encoding. The resulting bytes are then returned as a Unicode
string containing only ASCII characters. <p>
Note that this method should be used to encode only
"unstructured" RFC 822 headers. <p>
Example of usage:
<p><blockquote><pre>
MimePart part = ...
String rawvalue = "FooBar Mailer, Japanese version 1.1"
try {
// If we know for sure that rawvalue contains only US-ASCII
// characters, we can skip the encoding part
part.setHeader("X-mailer", MimeUtility.encodeText(rawvalue));
} catch (UnsupportedEncodingException e) {
// encoding failure
} catch (MessagingException me) {
// setHeader() failure
}
</pre></blockquote><p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>text</CODE> - Unicode string
<DT><B>Returns:</B><DD>Unicode string containing only US-ASCII characters
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/UnsupportedEncodingException.html?is-external=true" title="class or interface in java.io">UnsupportedEncodingException</A></CODE> - if the encoding fails</DL>
</DD>
</DL>
<HR>
<A NAME="encodeText(java.lang.String, java.lang.String, java.lang.String)"><!-- --></A><H3>
encodeText</H3>
<PRE>
public static <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>encodeText</B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> text,
<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> charset,
<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> encoding)
throws <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/UnsupportedEncodingException.html?is-external=true" title="class or interface in java.io">UnsupportedEncodingException</A></PRE>
<DL>
<DD>Encode a RFC 822 "text" token into mail-safe form as per
RFC 2047. <p>
The given Unicode string is examined for non US-ASCII
characters. If the string contains only US-ASCII characters,
it is returned as-is. If the string contains non US-ASCII
characters, it is first character-encoded using the specified
charset, then transfer-encoded using either the B or Q encoding.
The resulting bytes are then returned as a Unicode string
containing only ASCII characters. <p>
Note that this method should be used to encode only
"unstructured" RFC 822 headers.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>text</CODE> - the header value<DD><CODE>charset</CODE> - the charset. If this parameter is null, the
platform's default chatset is used.<
DD><
CODE>encoding<
/CODE> - the encoding to be used. Currently supported
values are "B" and "Q". If this parameter is null, then
the "Q" encoding is used if most of characters to be
encoded are in the ASCII charset, otherwise "B" encoding
is used.
<
DT><
B>Returns:<
/B><
DD>Unicode string containing only US-ASCII characters
<
DD><
CODE><
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/UnsupportedEncodingException.html?is-external=true" title="class or interface in java.io">UnsupportedEncodingException<
/A><
/CODE><
/DL>
<
A NAME="decodeText(java.lang.String)"><!-- --><
/A><
H3>
public static <
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String<
/A> <
B>decodeText<
/B>
(<
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String<
/A> etext
)
throws <
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/UnsupportedEncodingException.html?is-external=true" title="class or interface in java.io">UnsupportedEncodingException<
/A><
/PRE>
<
DD>Decode
"unstructured" headers, that is,
headers that are defined
as
'*text' as per RFC
822. <
p>
The string is decoded using the algorithm specified in
RFC 2047, Section 6.1. If the charset-conversion fails
for any sequence, an UnsupportedEncodingException is thrown.
If the String is not an RFC 2047 style encoded header, it is
Example of usage:
MimePart part = ...
String rawvalue = null;
String value = null;
try {
if ((rawvalue = part.getHeader("X-mailer")[0]) != null)
value = MimeUtility.decodeText(rawvalue);
} catch (UnsupportedEncodingException e) {
// Don't care
value = rawvalue;
} catch (MessagingException me) { }
return value;
</pre></blockquote><p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>etext</CODE> - the possibly encoded value
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/UnsupportedEncodingException.html?is-external=true" title="class or interface in java.io">UnsupportedEncodingException</A></CODE> - if the charset
conversion failed.</DL>
</DD>
</DL>
<HR>
<A NAME="encodeWord(java.lang.String)"><!-- --></A><H3>
encodeWord</H3>
<PRE>
public static <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>encodeWord</B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> word)
throws <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/UnsupportedEncodingException.html?is-external=true" title="class or interface in java.io">UnsupportedEncodingException</A></PRE>
<DL>
<DD>Encode a RFC 822 "word" token into mail-safe form as per
RFC 2047. <p>
The given Unicode string is examined for non US-ASCII
characters. If the string contains only US-ASCII characters,
it is returned as-is. If the string contains non US-ASCII
characters, it is first character-encoded using the platform's
default charset, then transfer-encoded using either the B or
Q encoding. The resulting bytes are then returned as a Unicode
string containing only ASCII characters. <
p>
This method is meant to be used when creating RFC 822 "phrases".
The InternetAddress class, for example, uses this to encode
it's 'phrase' component.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>word</CODE> - Unicode string
<DT><B>Returns:</B><DD>Array of Unicode strings containing only US-ASCII
characters.
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/UnsupportedEncodingException.html?is-external=true" title="class or interface in java.io">UnsupportedEncodingException</A></CODE> - if the encoding fails</DL>
</DD>
</DL>
<HR>
<A NAME="encodeWord(java.lang.String, java.lang.String, java.lang.String)"><!-- --></A><H3>
encodeWord</H3>
<PRE>
public static <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>encodeWord</B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> word,
<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> charset,
<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> encoding)
throws <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/UnsupportedEncodingException.html?is-external=true" title="class or interface in java.io">UnsupportedEncodingException</A></PRE>
<DL>
<DD>Encode a RFC 822 "word" token into mail-safe form as per
RFC 2047. <p>
The given Unicode string is examined for non US-ASCII
characters. If the string contains only US-ASCII characters,
it is returned as-is. If the string contains non US-ASCII
characters, it is first character-encoded using the specified
charset, then transfer-encoded using either the B or Q encoding.
The resulting bytes are then returned as a Unicode string
containing only ASCII characters. <p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>word</CODE> - Unicode string<DD><CODE>charset</CODE> - the MIME charset<DD><CODE>encoding</CODE> - the encoding to be used. Currently supported
values are "B" and "Q". If this parameter is null, then
the "Q" encoding is used if most of characters to be
encoded are in the ASCII charset, otherwise "B" encoding
is used.
<DT><B>Returns:</B><DD>Unicode string containing only US-ASCII characters
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/UnsupportedEncodingException.html?is-external=true" title="class or interface in java.io">UnsupportedEncodingException</A></CODE> - if the encoding fails</DL>
</DD>
</DL>
<HR>
<A NAME="decodeWord(java.lang.String)"><!-- --></A><H3>
decodeWord</H3>
<PRE>
public static <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>decodeWord</B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> eword)
throws <A HREF="../../../javax/mail/internet/ParseException.html" title="class in javax.mail.internet">ParseException</A>,
<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/UnsupportedEncodingException.html?is-external=true" title="class or interface in java.io">UnsupportedEncodingException</A></PRE>
<DL>
<DD>The string is parsed using the rules in RFC 2047 and RFC 2231 for
parsing an "encoded-word". If the parse fails, a ParseException is
thrown. Otherwise, it is transfer-decoded, and then
charset-converted into Unicode. If the charset-conversion
fails, an UnsupportedEncodingException is thrown.<p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>eword</CODE> - the encoded value
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../javax/mail/internet/ParseException.html" title="class in javax.mail.internet">ParseException</A></CODE> - if the string is not an
encoded-word as per RFC 2047 and RFC 2231.
<DD><CODE><A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/UnsupportedEncodingException.html?is-external=true" title="class or interface in java.io">UnsupportedEncodingException</A></CODE> - if the charset
conversion failed.</DL>
</DD>
</DL>
<HR>
<A NAME="quote(java.lang.String, java.lang.String)"><!-- --></A><H3>
quote</H3>
<PRE>
public static <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>quote</B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> word,
<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> specials)</PRE>
<DL>
<DD>A utility method to quote a word, if the word contains any
characters from the specified 'specials' list.<p>
The <code>HeaderTokenizer</code> class defines two special
sets of delimiters - MIME and RFC 822. <p>
This method is typically used during the generation of
RFC 822 and MIME header fields.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>word</CODE> - word to be quoted<DD><CODE>specials</CODE> - the set of special characters
<DT><B>Returns:</B><DD>the possibly quoted word<DT><B>See Also:</B><DD><A HREF="../../../javax/mail/internet/HeaderTokenizer.html#MIME"><CODE>HeaderTokenizer.MIME</CODE></A>,
<A HREF="../../../javax/mail/internet/HeaderTokenizer.html#RFC822"><CODE>HeaderTokenizer.RFC822</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="fold(int, java.lang.String)"><!-- --></A><H3>
fold</H3>
<PRE>
public static <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>fold</B>(int used,
<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> s)</PRE>
<DL>
<DD>Fold a string at linear whitespace so that each line is no longer
than 76 characters, if possible. If there are more than 76
non-whitespace characters consecutively, the string is folded at
the first whitespace after that sequence. The parameter
<code>used</code> indicates how many characters have been used in
the current line; it is usually the length of the header name. <p>
Note that line breaks in the string aren't escaped; they probably
should be.
<
DT><
B>Returns:<
/B><
DD>the folded string<
DT><
B>Since:<
/B><
/DT>
<
A NAME="unfold(java.lang.String)"><!-- --><
/A><
H3>
public static <
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String<
/A> <
B>unfold<
/B>
(<
A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String<
/A> s
)<
/PRE>
<
DD>Unfold a folded header. Any line breaks that aren
't escaped and
are followed by whitespace are removed.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>s</CODE> - the string to unfold
<DT><B>Returns:</B><DD>the unfolded string<DT><B>Since:</B></DT>
<DD>JavaMail 1.4</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="javaCharset(java.lang.String)"><!-- --></A><H3>
javaCharset</H3>
<PRE>
public static <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>javaCharset</B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> charset)</PRE>
<DL>
<DD>Convert a MIME charset name into a valid Java charset name. <p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>charset</CODE> - the MIME charset name
<DT><B>Returns:</B><DD>the Java charset equivalent. If a suitable mapping is
not available, the passed in charset is itself returned.</DL>
</DD>
</DL>
<HR>
<A NAME="mimeCharset(java.lang.String)"><!-- --></A><H3>
mimeCharset</H3>
<PRE>
public static <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>mimeCharset</B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> charset)</PRE>
<DL>
<DD>Convert a java charset into its MIME charset name. <p>
Note that a future version of JDK (post 1.2) might provide
this functionality, in which case, we may deprecate this
method then.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>charset</CODE> - the JDK charset
<DT><B>Returns:</B><DD>the MIME/IANA equivalent. If a mapping
is not possible, the passed in charset itself
is returned.<DT><B>Since:</B></DT>
<DD>JavaMail 1.1</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="getDefaultJavaCharset()"><!-- --></A><H3>
getDefaultJavaCharset</H3>
<PRE>
public static <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>getDefaultJavaCharset</B>()</PRE>
<DL>
<DD>Get the default charset corresponding to the system's current
default locale. If the System property <
code>mail.mime.charset<
/code>
is set, a system charset corresponding to this MIME charset will be
<
DT><
B>Returns:<
/B><
DD>the default
charset of the system
's default locale,
as a Java charset. (NOT a MIME charset)<DT><B>Since:</B></DT>
<DD>JavaMail 1.1</DD>
</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/MimeUtility.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../javax/mail/internet/MimePartDataSource.html" title="class in javax.mail.internet"><B>PREV CLASS</B></A>
<A HREF="../../../javax/mail/internet/NewsAddress.html" title="class in javax.mail.internet"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html?javax/mail/internet/MimeUtility.html" target="_top"><B>FRAMES</B></A>
<A HREF="MimeUtility.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<
A HREF="../../../allclasses-noframe.html"><
B>All Classes<
/B><
/A>
');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
Copyright © 2009 <a href="http://www.sun.com">Sun Microsystems, Inc.</a>. All Rights Reserved.
</BODY>
</HTML>