Oracle Communication and Mobility Server Java API Reference
E14335-01

oracle.sdp.parlayx.multimedia_messaging
Class ContentUtil

java.lang.Object
  extended by oracle.sdp.parlayx.multimedia_messaging.ContentUtil

public class ContentUtil
extends Object

Since:
release specific (what release of product did this appear in)

Field Summary
static javax.mail.internet.ContentType ANY_MULTIPART_TYPE
          ContentType object representing the "multipart/*" MIME type.
static javax.mail.internet.ContentType ANY_TEXT_TYPE
          ContentType object representing the "text/*" MIME type.
 
Constructor Summary
ContentUtil()
           
 
Method Summary
static byte[] getBytes(javax.mail.BodyPart p)
          Get binary (byte array) content from the provided BodyPart.
static byte[] getBytes(javax.activation.DataHandler dh)
          Get binary (byte array) content from the provided DataHandler.
static Object getContent(javax.mail.BodyPart p)
          Get content object from a BodyPart.
static Object getContent(javax.activation.DataHandler dh, String contentType)
          Get content object from a DataHandler.
static String getString(javax.mail.BodyPart p)
          Get String content from the provided BodyPart.
static String getString(javax.activation.DataHandler dh)
          Get String content from the provided DataHandler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ANY_MULTIPART_TYPE

public static javax.mail.internet.ContentType ANY_MULTIPART_TYPE
ContentType object representing the "multipart/*" MIME type.


ANY_TEXT_TYPE

public static javax.mail.internet.ContentType ANY_TEXT_TYPE
ContentType object representing the "text/*" MIME type.

Constructor Detail

ContentUtil

public ContentUtil()
Method Detail

getString

public static String getString(javax.mail.BodyPart p)
                        throws javax.mail.MessagingException,
                               IOException
Get String content from the provided BodyPart. Unwraps any DataHandler/DataSource to get the underlying String data.

Parameters:
p -
Returns:
Throws:
javax.mail.MessagingException
IOException

getString

public static String getString(javax.activation.DataHandler dh)
                        throws javax.mail.MessagingException,
                               IOException
Get String content from the provided DataHandler. Unwraps any DataSource to get the underlying String data.

Parameters:
dh -
Returns:
Throws:
javax.mail.MessagingException
IOException

getBytes

public static byte[] getBytes(javax.mail.BodyPart p)
                       throws javax.mail.MessagingException,
                              IOException
Get binary (byte array) content from the provided BodyPart. Unwraps any DataHandler/DataSource to get the underlying byte data.

Parameters:
p -
Returns:
Throws:
javax.mail.MessagingException
IOException

getBytes

public static byte[] getBytes(javax.activation.DataHandler dh)
                       throws javax.mail.MessagingException,
                              IOException
Get binary (byte array) content from the provided DataHandler. Unwraps any DataSource to get the underlying byte data.

Parameters:
dh -
Returns:
Throws:
javax.mail.MessagingException
IOException

getContent

public static Object getContent(javax.mail.BodyPart p)
                         throws javax.mail.MessagingException,
                                IOException
Get content object from a BodyPart. If this is a BodyPart for which String or byte[] content has been wrapped in a DataHandler/DataSource, unwrap the original object and return it. If this part contains a Multipart object, return that. Otherwise defer to the JavaMail getContent implementation, which depends on a correctly configured CommandMap and is therefore not reliable in all environments.

Parameters:
p -
Returns:
Throws:
javax.mail.MessagingException
IOException

getContent

public static Object getContent(javax.activation.DataHandler dh,
                                String contentType)
                         throws javax.mail.MessagingException,
                                IOException
Get content object from a DataHandler. If this is a BodyPart for which String or byte[] content has been wrapped in a DataSource, unwrap the original object and return it. If this part contains a Multipart object, return that. Otherwise defer to the JavaMail getContent implementation, which depends on a correctly configured CommandMap and is therefore not reliable in all environments.

Parameters:
p -
Returns:
Throws:
javax.mail.MessagingException
IOException


Copyright © 2007-2009 Oracle Corporation. All Rights Reserved.