net.sourceforge.jmmslib
Class MmsPart

java.lang.Object
  extended by net.sourceforge.jmmslib.MmsPart

public class MmsPart
extends java.lang.Object

Defines a part of the MMS message.

Actually part can contain only text and images.

Here a brief example on how to use the class.

          MmsMessage mms = new MmsMessage();
          //fill the fields...
 
          MmsPart p = new MmsPart();
          p.setPartContent(new String("Hello World").getBytes("US-ASCII"));
    p.setPartContentType(MmsMessage.CTYPE_TEXT_PLAIN);

    mms.addPart(p);
        

Author:
Andrea Zito

Constructor Summary
MmsPart()
          Creates an MmsPart object
 
Method Summary
 java.lang.String getPartCharset()
          Returns the charset for the content.
 byte[] getPartContent()
          Returns the buffer containing the part data.
 java.lang.String getPartContentType()
          Returns the part content type.
 java.lang.String getPartId()
          Returns the part identifier.
 void setPartCharset(java.lang.String charset)
          Sets the charset for the content.
 void setPartContent(byte[] buffer)
          Sets the part data.
 void setPartContent(java.io.File f)
          Sets the part data from a file.
 void setPartContent(java.lang.String filePath)
          Sets the part data from a file name.
 void setPartContentType(java.lang.String contentType)
          Sets the part content type.
 void setPartId(java.lang.String id)
          Sets the part identifier.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MmsPart

public MmsPart()
Creates an MmsPart object

Method Detail

setPartId

public void setPartId(java.lang.String id)
Sets the part identifier.

Parameters:
id - part identifier

setPartContent

public void setPartContent(byte[] buffer)
Sets the part data.

Parameters:
buffer - part data buffer

setPartContent

public void setPartContent(java.io.File f)
                    throws java.io.FileNotFoundException,
                           MmsContentException
Sets the part data from a file.

Parameters:
f - part data file
Throws:
java.io.FileNotFoundException
MmsContentException - part data too big

setPartContent

public void setPartContent(java.lang.String filePath)
                    throws java.io.FileNotFoundException,
                           MmsContentException
Sets the part data from a file name. This implementation calls setPartContent(new File(filePath));

Parameters:
filePath - path of the part data file
Throws:
java.io.FileNotFoundException
MmsContentException

setPartContentType

public void setPartContentType(java.lang.String contentType)
Sets the part content type.

Parameters:
contentType - part content type

getPartId

public java.lang.String getPartId()
Returns the part identifier.

Returns:
part identifier

getPartContent

public byte[] getPartContent()
Returns the buffer containing the part data.

Returns:
part data buffer

getPartContentType

public java.lang.String getPartContentType()
Returns the part content type.

Returns:
part content type

getPartCharset

public java.lang.String getPartCharset()
Returns the charset for the content. Valid only in case of text/ content type.

Returns:
charset

setPartCharset

public void setPartCharset(java.lang.String charset)
Sets the charset for the content. Valid only in case of text/ content type.

Parameters:
charset - charset