com.objectxp.mms.message
Class GenericMessagePart

java.lang.Object
  extended by com.objectxp.mms.message.GenericMessagePart
All Implemented Interfaces:
MMSMessagePart, java.io.Serializable

public class GenericMessagePart
extends java.lang.Object
implements MMSMessagePart, java.io.Serializable

Simple implementation of the MMSMessagePart interface. Instances of this class can be added to a MMSMessage.

The GenericMessagePart should not be used with a SMILMessage. Use a SMILDocument instead.

See Also:
Serialized Form

Constructor Summary
GenericMessagePart(java.lang.String contentType, byte[] content)
          Construct a generic message part.
GenericMessagePart(java.lang.String contentType, java.io.File content)
          Construct a generic message part by reading the specified input stream.
GenericMessagePart(java.lang.String contentType, java.io.InputStream content)
          Construct a generic message part by reading the specified input stream.
GenericMessagePart(java.lang.String contentType, java.lang.String contentLocation, byte[] content)
          Construct a generic message part.
GenericMessagePart(java.lang.String contentType, java.lang.String contentLocation, java.io.InputStream content)
          Construct a generic message part by reading the specified input stream.
 
Method Summary
 java.lang.String getCharset()
          Get the character set of the content.
 byte[] getContent()
          Get the content data of this message part.
 java.lang.String getContentLocation()
          Get the content location of this message part.
 java.lang.String getContentType()
          Get the content-type of this message part.
 java.lang.String getMimeType()
          Get the mime-type of this message part.
 void setCharset(java.lang.String charset)
          Set the character set (encoding) that has been used for encoding the content.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericMessagePart

public GenericMessagePart(java.lang.String contentType,
                          byte[] content)
Construct a generic message part.

Parameters:
contentType - the type of the content (e.g. 'image/jpeg').
content - the content data

GenericMessagePart

public GenericMessagePart(java.lang.String contentType,
                          java.io.File content)
                   throws java.io.IOException
Construct a generic message part by reading the specified input stream.

Parameters:
contentType - the type of the content (e.g. "text/plain")
content - the File holding the content
Throws:
java.io.IOException - if reading from the stream results in an error
Since:
jSMS 2.1

GenericMessagePart

public GenericMessagePart(java.lang.String contentType,
                          java.io.InputStream content)
                   throws java.io.IOException
Construct a generic message part by reading the specified input stream.

Parameters:
contentType - the type of the content (e.g. "text/plain")
content - the InputStream for reading the content
Throws:
java.io.IOException - if reading from the stream results in an error
Since:
jSMS 2.1

GenericMessagePart

public GenericMessagePart(java.lang.String contentType,
                          java.lang.String contentLocation,
                          java.io.InputStream content)
                   throws java.io.IOException
Construct a generic message part by reading the specified input stream.

Parameters:
contentType - the type of the content (e.g. "text/plain")
contentLocation - the content location
content - the InputStream for reading the content
Throws:
java.io.IOException - if reading from the stream results in an error
Since:
jSMS 2.1.8

GenericMessagePart

public GenericMessagePart(java.lang.String contentType,
                          java.lang.String contentLocation,
                          byte[] content)
Construct a generic message part.

Parameters:
contentType - the type of the content (e.g. "text/plain")
contentLocation - the content location
content - the content
Method Detail

getContent

public byte[] getContent()
Description copied from interface: MMSMessagePart
Get the content data of this message part.

Specified by:
getContent in interface MMSMessagePart
Returns:
a byte[] with the content data.

getMimeType

public java.lang.String getMimeType()
Description copied from interface: MMSMessagePart
Get the mime-type of this message part. The mime-type is part of the content-type.

Specified by:
getMimeType in interface MMSMessagePart
Returns:
the mimeType of the content.

getContentLocation

public java.lang.String getContentLocation()
Description copied from interface: MMSMessagePart
Get the content location of this message part. A SMIL document refers to this location.

Specified by:
getContentLocation in interface MMSMessagePart
Returns:
the location of the content.

setCharset

public void setCharset(java.lang.String charset)
Description copied from interface: MMSMessagePart
Set the character set (encoding) that has been used for encoding the content. If unset, jSMS assumes that the text has been encoded using your platforms default character encoding. The character set is ignored for binary content.

Specified by:
setCharset in interface MMSMessagePart
Parameters:
charset - the character set (e.g. "UTF-8").

getCharset

public java.lang.String getCharset()
Description copied from interface: MMSMessagePart
Get the character set of the content. The character set is ignored for binary content.

Specified by:
getCharset in interface MMSMessagePart
Returns:
the character set or null if unset.

getContentType

public java.lang.String getContentType()
Description copied from interface: MMSMessagePart
Get the content-type of this message part.

Specified by:
getContentType in interface MMSMessagePart
Returns:
the content-type.


object XP, Inc. © 2000-2008. All rights reserved object XP