|
Oracle® Globalization Development Kit Java API Reference 10g Release 1(10.1) B10971-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--oracle.i18n.net.MimeUtility
MimeUtility is the MIME utility class that contains encoder and decoder for
MIME header and body text. This is an alternative of
javax.mail.internet.MimeUtility
but this allows you to use
Oracle or IANA character set names.
RFC 2047 specifies the MIME-safe header and body format. The mail header must be in the following US-ASCII character set encoding:
=? <charset> ? <encoding> ? <encoded-text> ?=
This output can be generated using encodeHeader(String, String,
String)
method. The receiver of the data is able to decode it based on
the included character set (e.g., iso-8859-1
) and encoding
("B"
or "Q"
) information using decodeHeader(String)
.
Meanwhile, based on RFC 2045, MIME body will not include the character set
and encoding information that is generated by #encodeBody(String,
String, String)
method. Hence, those information must be provided to the
receiver by higher level of protocol when it uses #decodeBody(String, String, String)
.
Method Summary | |
static String |
decodeHeader(String srcstr)
Decodes a MIME-safe form into a String for MIME header as per
RFC 2047.
|
static String |
encodeHeader(String srcstr,
String charset,
String encoding)
Encodes a String into a MIME-safe form for MIME header as per
RFC 2047.
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static String encodeHeader(String srcstr, String charset, String encoding) throws UnsupportedEncodingException
String
into a MIME-safe form for MIME header as per
RFC 2047.
Currently AL16UTF16(aka. UTF-16BE) is not supported.
The output includes the character set and encoding (e.g., Base64 or Quoted-Printable) information in the following form:
=? <charset> ? <encoding> ? <encoded-text>
?=
srcstr
- a String
to be encoded.charset
- an Oracle or IANA character set name.encoding
- base64 ("B") or quoted-printable ("Q")
UnsupportedEncodingException
- if the character set name is invalid
or not supported.public static String decodeHeader(String srcstr) throws UnsupportedEncodingException
String
for MIME header as per
RFC 2047.
The input is expected to include the character set and encoding (e.g., Base64 or Quoted-Printable) information in the following form:
=? <charset> ? <encoding> ? <encoded-text>
?=
srcstr
- a String
to be decoded.
UnsupportedEncodingException
- - if the character set name is
invalid or not supported
IllegalArgumentException
- if invalid MIME header is detected.
|
Oracle® Globalization Development Kit Java API Reference 10g Release 1(10.1) B10971-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |