mimeutility.html

来自「j2ee帮助文档软件设计/软件工程 文件格式」· HTML 代码 · 共 930 行 · 第 1/4 页

HTML
930
字号
 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.5/docs/api/java/io/UnsupportedEncodingException.html" 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.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>decodeWord</B>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;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.5/docs/api/java/io/UnsupportedEncodingException.html" title="class or interface in java.io">UnsupportedEncodingException</A></PRE><DL><DD>The string is parsed using the rules in RFC 2047 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.<DD><CODE><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/io/UnsupportedEncodingException.html" 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.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>quote</B>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;word,                           <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;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.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>fold</B>(int&nbsp;used,                          <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;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.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>used</CODE> - characters used in line so far<DD><CODE>s</CODE> - the string to fold<DT><B>Returns:</B><DD>the folded string<DT><B>Since:</B></DT>  <DD>JavaMail 1.4</DD></DL></DD></DL><HR><A NAME="unfold(java.lang.String)"><!-- --></A><H3>unfold</H3><PRE>public static <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>unfold</B>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;s)</PRE><DL><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.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>javaCharset</B>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;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.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>mimeCharset</B>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;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.5/docs/api/java/lang/String.html" 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 returned. <p><P><DD><DL><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>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="../../../javax/mail/internet/MimePartDataSource.html" title="class in javax.mail.internet"><B>PREV CLASS</B></A>&nbsp;&nbsp;<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>  &nbsp;&nbsp;<A HREF="MimeUtility.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;&nbsp;<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:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_bottom"></A><!-- ======== END OF BOTTOM NAVBAR ======= --><HR><font size="-1"><a href="http://java.sun.com/webapps/bugreport">Submit a bug or feature</a> <p>Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to <a href="../legal/license.html" target="_top">license terms.</a></font></BODY></HTML>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?