⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mimeutility.html

📁 j2ee的API 1.4版本,j2ee的帮助文档
💻 HTML
📖 第 1 页 / 共 4 页
字号:
 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><P><DD><DL><DT><B>Since:</B></DT>  <DD>JavaMail 1.2</DD></DL></DD></DL><HR><A NAME="decode(java.io.InputStream, java.lang.String)"><!-- --></A><H3>decode</H3><PRE>public static <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/io/InputStream.html" title="class or interface in java.io">InputStream</A> <B>decode</B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/io/InputStream.html" title="class or interface in java.io">InputStream</A>&nbsp;is,                                 <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;encoding)                          throws <A HREF="../../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></PRE><DL><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 supported.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>is</CODE> - input stream<DD><CODE>encoding</CODE> - the encoding of the stream.<DT><B>Returns:</B><DD>decoded input stream.<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></CODE></DL></DD></DL><HR><A NAME="encode(java.io.OutputStream, java.lang.String)"><!-- --></A><H3>encode</H3><PRE>public static <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/io/OutputStream.html" title="class or interface in java.io">OutputStream</A> <B>encode</B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/io/OutputStream.html" title="class or interface in java.io">OutputStream</A>&nbsp;os,                                  <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;encoding)                           throws <A HREF="../../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></PRE><DL><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.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>os</CODE> - output stream<DD><CODE>encoding</CODE> - the encoding of the stream.<DT><B>Returns:</B><DD>output stream that applies the				specified encoding.<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></CODE></DL></DD></DL><HR><A NAME="encode(java.io.OutputStream, java.lang.String, java.lang.String)"><!-- --></A><H3>encode</H3><PRE>public static <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/io/OutputStream.html" title="class or interface in java.io">OutputStream</A> <B>encode</B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/io/OutputStream.html" title="class or interface in java.io">OutputStream</A>&nbsp;os,                                  <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;encoding,                                  <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;filename)                           throws <A HREF="../../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></PRE><DL><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.<P><DD><DL><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.<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></CODE><DT><B>Since:</B></DT>  <DD>JavaMail 1.2</DD></DL></DD></DL><HR><A NAME="encodeText(java.lang.String)"><!-- --></A><H3>encodeText</H3><PRE>public static <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>encodeText</B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;text)                         throws <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/io/UnsupportedEncodingException.html" 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 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/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="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/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>encodeText</B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;text,                                <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;charset,                                <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;encoding)                         throws <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/io/UnsupportedEncodingException.html" 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<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/io/UnsupportedEncodingException.html" title="class or interface in java.io">UnsupportedEncodingException</A></CODE></DL></DD></DL><HR><A NAME="decodeText(java.lang.String)"><!-- --></A><H3>decodeText</H3><PRE>public static <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>decodeText</B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;etext)                         throws <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/io/UnsupportedEncodingException.html" title="class or interface in java.io">UnsupportedEncodingException</A></PRE><DL><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.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 returned as-is <p> Example of usage: <p><blockquote><pre>  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/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="encodeWord(java.lang.String)"><!-- --></A><H3>encodeWord</H3><PRE>public static <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>encodeWord</B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;word)                         throws <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/io/UnsupportedEncodingException.html" 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>

⌨️ 快捷键说明

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