Java Doc for MultipartObject.java in  » 6.0-JDK-Modules » j2me » com » sun » tck » wma » mms » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » j2me » com.sun.tck.wma.mms 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.sun.tck.wma.sms.MessageObject
      com.sun.tck.wma.mms.MultipartObject

MultipartObject
public class MultipartObject extends MessageObject implements MultipartMessage(Code)
Implements an MMS message for the MMS message connection.


Field Summary
final static  String[]ALLOWED_HEADER_FIELDS
     Array of allowed MMS header fields.
final static  String[]DEFAULT_HEADER_VALUES
     Array of default header values.
final static  String[]KNOWN_HEADER_FIELDS
     Array of known header fields.
final static  intMAX_TOTAL_SIZE
     Maximum size of MMS message.
final static  StringSTREAM_SIGNATURE
     The content type for the MMS message.
 StringapplicationID
     The Application Identifier of the agent to process the message.
 Vectorbcc
     The array of "bcc" addresses.
 Vectorcc
     The array of "cc" addresses.
 String[]headerValues
     The array of message headers.
 Vectorparts
     The array of message parts.
 StringreplyToApplicationID
     The Application Identifier of the return agent to process the message.
 StringstartContentID
     The Content-ID of the part that starts the message.
 Stringsubject
     The Subject field of the message.
 Vectorto
     The array of "to" addresses.

Constructor Summary
public  MultipartObject(String toAddress)
     Construct a multipart message and initialize the target address.

Method Summary
public  booleanaddAddress(java.lang.String type, java.lang.String address)
     Adds an address to the multipart message.
Parameters:
  type - the address type ("to", "cc" or "bcc") as a String.
public  voidaddMessagePart(MessagePart part)
     Attaches a MessagePart to the multipart message.
Parameters:
  part - MessagePart to add
exception:
  java.lang.IllegalArgumentException - if the Content-ID of theMessagePart conflicts with a Content-ID of aMessagePart already contained in this MultiPartMessage.
 voidcheckApplicationID(String newAppID)
     Checks an application ID to see if it can be legally added to this message.
static  voidcheckHeaderValue(int headerIndex, String value)
     Checks the header field value.
 MMSAddresscheckValidAddress(String addr)
     Checks if the string is a valid MMS address according to the grammar in Appendix D of the spec.
public static  MultipartObjectcreateFromByteArray(byte[] data)
     Create a message object from a serialized byte array.
static  MessagePartcreateMessagePart(DataInputStream dis)
    
public  voidfixupReceivedMessageAddresses(String senderAddress, String myAddress)
     Prepares a received message to be sent right back to the sender. Removes this device's address from the "to" and "cc" address lists and sets the sender's address as the first "to" address.
Parameters:
  senderAddress - the sender's address.
public  java.lang.StringgetAddress()
     Returns the "from" address associated with this message, e.g.
 VectorgetAddressList(String type)
     Gets the requested address list.
public  java.lang.String[]getAddresses(java.lang.String type)
     Gets the addresses of the multipart message of the specified type (e.g. "to", "cc", "bcc" or "from") as String.
public  StringgetApplicationID()
     Returns the destination application identifier.
public  byte[]getAsByteArray()
     Gets the message object as a byte array.
public  byte[]getBodyAsByteArray()
     Gets the message object body as a byte array.
static  StringgetDevicePortionOfAddress(String address)
     Returns only the device part of the MMS Address.
public  java.lang.StringgetHeader(java.lang.String headerField)
     Gets the content of the specific header field of the multipart message.
public  byte[]getHeaderAsByteArray()
     Gets the message object header as a byte array.
static  intgetHeaderFieldIndex(String headerField)
     Gets the location of the requested header from the list of allowed header fields.
public  MessagePartgetMessagePart(java.lang.String contentID)
     This method returns a MessagePart from the message that matches the content-id passed as a parameter.
public  MessagePart[]getMessageParts()
     Returns an array of all MessageParts of this message.
 StringgetReplyToApplicationID()
     Gets the "reply-to" application identifier.
public  java.lang.StringgetStartContentId()
     Returns the contentId of the start MessagePart.
public  java.lang.StringgetSubject()
     Gets the subject of the multipart message.
 booleanisAllowedToAccessHeaderField(String field)
     Checks if allowed to access the requested header field.
static  booleanisKnownHeaderField(String headerField)
     Checks if header field is known.
static  voidreadVector(DataInputStream dis, Vector v, boolean isAddress)
     Reads a vector from an input stream.
public  booleanremoveAddress(java.lang.String type, java.lang.String address)
     Removes an address from the multipart message.
public  voidremoveAddresses()
     Removes all addresses of types "to", "cc", "bcc" from the multipart message.
public  voidremoveAddresses(java.lang.String type)
     Removes all addresses of the specified type from the multipart message.
public  booleanremoveMessagePart(MessagePart part)
     Removes a MessagePart from the multipart message.
public  booleanremoveMessagePartId(java.lang.String contentID)
     Removes a MessagePart with the specific contentID from the multipart message.
Parameters:
  contentID - identifies which MessagePart must bedeleted.
public  booleanremoveMessagePartLocation(java.lang.String contentLocation)
     Removes MessageParts with the specific content location from the multipart message.
public  voidsetAddress(java.lang.String address)
     Sets the "to" address associated with this message.
public  voidsetFromAddress(String fromAddress)
     Sets the "from" address.
public  voidsetHeader(java.lang.String headerField, java.lang.String headerValue)
     Sets the specified header of the multipart message.
public  voidsetReplyToApplicationID(String appID)
     Sets the "reply-to" application identifier.
Parameters:
  appID - the return address application identifier.
public  voidsetStartContentId(java.lang.String contentId)
     Sets the Content-ID of the start MessagePart of a multipart related message.
public  voidsetSubject(java.lang.String subject)
     Sets the Subject of the multipart message.
 voidsetupHeaderFields()
     Sets default values for all allowed header fields.
static  voidwriteMessagePart(DataOutputStream dos, MessagePart p)
    
static  voidwriteVector(DataOutputStream dos, Vector v, boolean isAddress)
     Writes a vector to an output stream.

Field Detail
ALLOWED_HEADER_FIELDS
final static String[] ALLOWED_HEADER_FIELDS(Code)
Array of allowed MMS header fields.



DEFAULT_HEADER_VALUES
final static String[] DEFAULT_HEADER_VALUES(Code)
Array of default header values.



KNOWN_HEADER_FIELDS
final static String[] KNOWN_HEADER_FIELDS(Code)
Array of known header fields.



MAX_TOTAL_SIZE
final static int MAX_TOTAL_SIZE(Code)
Maximum size of MMS message. Default value is 30730 (30K)



STREAM_SIGNATURE
final static String STREAM_SIGNATURE(Code)
The content type for the MMS message.



applicationID
String applicationID(Code)
The Application Identifier of the agent to process the message.



bcc
Vector bcc(Code)
The array of "bcc" addresses.



cc
Vector cc(Code)
The array of "cc" addresses.



headerValues
String[] headerValues(Code)
The array of message headers.



parts
Vector parts(Code)
The array of message parts.



replyToApplicationID
String replyToApplicationID(Code)
The Application Identifier of the return agent to process the message.



startContentID
String startContentID(Code)
The Content-ID of the part that starts the message.



subject
String subject(Code)
The Subject field of the message.



to
Vector to(Code)
The array of "to" addresses.




Constructor Detail
MultipartObject
public MultipartObject(String toAddress)(Code)
Construct a multipart message and initialize the target address.
Parameters:
  toAddress - the address of the recipient. May be null.




Method Detail
addAddress
public boolean addAddress(java.lang.String type, java.lang.String address) throws IllegalArgumentException(Code)
Adds an address to the multipart message.
Parameters:
  type - the address type ("to", "cc" or "bcc") as a String. Each message can have none or multiple "to","cc" and "bcc" addresses. Each address is added separately. Thetype is not case-sensitive.
Parameters:
  address - the address as a String true if it was possible to add the address, elsefalse
exception:
  java.lang.IllegalArgumentException - if type is none of "to", "cc", or "bcc" or if address is not valid.
See Also:   MultipartObject.setAddress(String)



addMessagePart
public void addMessagePart(MessagePart part) throws SizeExceededException(Code)
Attaches a MessagePart to the multipart message.
Parameters:
  part - MessagePart to add
exception:
  java.lang.IllegalArgumentException - if the Content-ID of theMessagePart conflicts with a Content-ID of aMessagePart already contained in this MultiPartMessage. The Content-IDs must be uniquewithin a MultipartMessage.
exception:
  NullPointerException - if the parameter is null
exception:
  SizeExceededException - if it's not possible to attach the MessagePart.



checkApplicationID
void checkApplicationID(String newAppID) throws IllegalArgumentException(Code)
Checks an application ID to see if it can be legally added to this message. The spec requires that only a single applicationID can be specified for any MultipartMessage.
Parameters:
  newAppID - the candidate applicationID to check. May be null
throws:
  IllegalArgumentException - if newAppID conflicts with anapplicationID already specified for this message.



checkHeaderValue
static void checkHeaderValue(int headerIndex, String value)(Code)
Checks the header field value.
Parameters:
  headerIndex - the index of the header field to check
Parameters:
  value - the value to be checked
exception:
  Error - if an invalid header index is requested
exception:
  IllegalArgumentException - if the value is nota valid delivery time or priority



checkValidAddress
MMSAddress checkValidAddress(String addr) throws IllegalArgumentException(Code)
Checks if the string is a valid MMS address according to the grammar in Appendix D of the spec.
Parameters:
  addr - the address to check MMSAddress representing the valid address, otherwise null.



createFromByteArray
public static MultipartObject createFromByteArray(byte[] data) throws IOException(Code)
Create a message object from a serialized byte array.
Parameters:
  data - a serialized byte array of a message object the multipart message object
exception:
  IOException - if any I/O errors occur



createMessagePart
static MessagePart createMessagePart(DataInputStream dis) throws IOException(Code)
Create a new message part from the input stream
Parameters:
  dis - the data input stream for reading
exception:
  IOException - if any I/O errors occur the message object instance



fixupReceivedMessageAddresses
public void fixupReceivedMessageAddresses(String senderAddress, String myAddress)(Code)
Prepares a received message to be sent right back to the sender. Removes this device's address from the "to" and "cc" address lists and sets the sender's address as the first "to" address.
Parameters:
  senderAddress - the sender's address. Should not include the "mms://" prefix, and may contain the ":appID" suffix. May be null.
Parameters:
  myAddress - this device's address. Must not be null.



getAddress
public java.lang.String getAddress()(Code)
Returns the "from" address associated with this message, e.g. address of the sender. If the message is a newly created message, e.g. not a received one, then the first "to" address is returned. Returns null if the "from" or "to" address for the message, dependent on the case, are not set. Note: This design allows sending responses to a received message easily by reusing the same Message object and just replacing the payload. The address field can normally be kept untouched (unless the used messaging protocol requires some special handling of the address). the "from" or "to" address of this message, or nullif the address that is expected as a result of this method is notset
See Also:   MultipartObject.setAddress(String)



getAddressList
Vector getAddressList(String type)(Code)
Gets the requested address list.
Parameters:
  type - the address list to be returned, either "to", "cc" or "bcc"
exception:
  IllegalArgumentException - if some other address list type is requested a list of addresses



getAddresses
public java.lang.String[] getAddresses(java.lang.String type)(Code)
Gets the addresses of the multipart message of the specified type (e.g. "to", "cc", "bcc" or "from") as String. The method is not case sensitive.
Parameters:
  type - the type of addresses to return the addresses as a String array or nullif this value is not present.



getApplicationID
public String getApplicationID()(Code)
Returns the destination application identifier. the destination application identifier, or null if none is set



getAsByteArray
public byte[] getAsByteArray() throws IOException(Code)
Gets the message object as a byte array.
exception:
  IOException - if any I/O errors occur the serialized byte array of the message object



getBodyAsByteArray
public byte[] getBodyAsByteArray() throws IOException(Code)
Gets the message object body as a byte array. The body is composed of a single header that states the number of entries, followed by a serialized array of MessagePart objects.
throws:
  IOException - if any I/O errors occur. the serialized byte array of the message body.



getDevicePortionOfAddress
static String getDevicePortionOfAddress(String address) throws IllegalArgumentException(Code)
Returns only the device part of the MMS Address. the device portion of the MMS Address
Parameters:
  address - the MMS address
throws:
  IllegalArgumentException - if the MMS Address has nodevice portion.



getHeader
public java.lang.String getHeader(java.lang.String headerField)(Code)
Gets the content of the specific header field of the multipart message.
Parameters:
  headerField - the name of the header field as a String the content of the specified header field as a String or null of the specified headerfield is not present.
exception:
  SecurityException - if the access to specified header field is restricted
exception:
  IllegalArgumentException - if headerField is unknown
See Also:   Appendix
See Also:    D for known headerFields
See Also:   MultipartObject.setHeader



getHeaderAsByteArray
public byte[] getHeaderAsByteArray() throws IOException(Code)
Gets the message object header as a byte array. The header is composed of a number of fields and is exclusive of the MessagePart contents.
throws:
  IOException - if any I/O errors occur. the serialized byte array of the message object



getHeaderFieldIndex
static int getHeaderFieldIndex(String headerField)(Code)
Gets the location of the requested header from the list of allowed header fields.
Parameters:
  headerField - the header field key to be checked the index of the requested header field, or -1 if the header is not supported



getMessagePart
public MessagePart getMessagePart(java.lang.String contentID)(Code)
This method returns a MessagePart from the message that matches the content-id passed as a parameter.
Parameters:
  contentID - the content-id for the MessagePart to bereturned MessagePart that matches the provided content-id ornull if there is no MessagePart in thismessage with the provided content-id
exception:
  NullPointerException - if the parameter is null



getMessageParts
public MessagePart[] getMessageParts()(Code)
Returns an array of all MessageParts of this message. array of MessageParts, or null if noMessageParts are available



getReplyToApplicationID
String getReplyToApplicationID()(Code)
Gets the "reply-to" application identifier. the return address application identifier, or null if none is set
See Also:   MultipartObject.setReplyToApplicationID



getStartContentId
public java.lang.String getStartContentId()(Code)
Returns the contentId of the start MessagePart. The start MessagePart is set in setStartContentId(String) the content-id of the start MessagePart ornull if the start MessagePart is not set.
See Also:   MultipartObject.setStartContentId(String)



getSubject
public java.lang.String getSubject()(Code)
Gets the subject of the multipart message. the message subject as a String or nullif this value is not present.
See Also:   MultipartObject.setSubject



isAllowedToAccessHeaderField
boolean isAllowedToAccessHeaderField(String field)(Code)
Checks if allowed to access the requested header field.
Parameters:
  field - the header field key to check true if the header exists



isKnownHeaderField
static boolean isKnownHeaderField(String headerField)(Code)
Checks if header field is known.
Parameters:
  headerField - the header field key to check true if the header is known



readVector
static void readVector(DataInputStream dis, Vector v, boolean isAddress) throws IOException(Code)
Reads a vector from an input stream. If the content is an MMS Address, as indicated by the isAddress parameter, then the prefix "mms://" is added to each address.
Parameters:
  dis - the data input stream for reading
Parameters:
  v - the array to be returned
Parameters:
  isAddress - the contents are MMS Addresses
exception:
  IOException - if any I/O errors occur



removeAddress
public boolean removeAddress(java.lang.String type, java.lang.String address)(Code)
Removes an address from the multipart message.
Parameters:
  type - the address type ("to", "cc", or "bcc") as aString
Parameters:
  address - the address as a String true if it was possible to delete the address, elsefalse
throws:
  NullPointerException - is type is null
throws:
  java.lang.IllegalArgumentException - if type is none of "to", "cc",or "bcc"



removeAddresses
public void removeAddresses()(Code)
Removes all addresses of types "to", "cc", "bcc" from the multipart message.
See Also:   MultipartObject.setAddress(String)
See Also:   MultipartObject.addAddress(String,String)



removeAddresses
public void removeAddresses(java.lang.String type)(Code)
Removes all addresses of the specified type from the multipart message.
Parameters:
  type - the address type ("to", "cc", or "bcc") as a String
throws:
  NullPointerException - if type is null
throws:
  java.lang.IllegalArgumentException - if type is none of "to", "cc",or "bcc"



removeMessagePart
public boolean removeMessagePart(MessagePart part)(Code)
Removes a MessagePart from the multipart message.
Parameters:
  part - MessagePart to delete true if it was possible to remove theMessagePart, else false
exception:
  NullPointerException - id the parameter is null



removeMessagePartId
public boolean removeMessagePartId(java.lang.String contentID)(Code)
Removes a MessagePart with the specific contentID from the multipart message.
Parameters:
  contentID - identifies which MessagePart must bedeleted. true if it was possible to remove theMessagePart, else false
exception:
  NullPointerException - if the parameter is null



removeMessagePartLocation
public boolean removeMessagePartLocation(java.lang.String contentLocation)(Code)
Removes MessageParts with the specific content location from the multipart message. All MessageParts with the specified contentLocation are removed.
Parameters:
  contentLocation - content location (file name) of the MessagePart true if it was possible to remove theMessagePart, else false
exception:
  NullPointerException - if the parameter is null



setAddress
public void setAddress(java.lang.String address)(Code)
Sets the "to" address associated with this message. It works the same way as addAddress("to", addr). The address may be set to null.
Parameters:
  address - address for the message
See Also:   MultipartObject.getAddress()
See Also:   MultipartObject.addAddress(String,String)



setFromAddress
public void setFromAddress(String fromAddress)(Code)
Sets the "from" address.
Parameters:
  fromAddress - the return address, which may be null



setHeader
public void setHeader(java.lang.String headerField, java.lang.String headerValue)(Code)
Sets the specified header of the multipart message. The header value can be null.
Parameters:
  headerField - the name of the header field as a String
Parameters:
  headerValue - the value of the header as a String
exception:
  java.lang.IllegalArgumentException - if headerField is unknown, or if headerValue is not correct (depends onheaderField!)
exception:
  NullPointerException - if headerField is null
exception:
  SecurityException - if the access to specified header field isrestricted
See Also:   MultipartObject.getHeader(String)
See Also:   Appendix
See Also:    D



setReplyToApplicationID
public void setReplyToApplicationID(String appID)(Code)
Sets the "reply-to" application identifier.
Parameters:
  appID - the return address application identifier. May be null.
See Also:   MultipartObject.getReplyToApplicationID



setStartContentId
public void setStartContentId(java.lang.String contentId)(Code)
Sets the Content-ID of the start MessagePart of a multipart related message. The Content-ID may be set to null. The StartContentId is set for the MessagePart that is used to reference the other MessageParts of the MultipartMessage for presentation or processing purposes.
Parameters:
  contentId - as a String
exception:
  java.lang.IllegalArgumentException - if contentId is none of the added MessagePart objects matches thecontentId
See Also:   MultipartObject.getStartContentId()



setSubject
public void setSubject(java.lang.String subject)(Code)
Sets the Subject of the multipart message. This value can be null.
Parameters:
  subject - the message subject as a String
See Also:   MultipartObject.getSubject()



setupHeaderFields
void setupHeaderFields()(Code)
Sets default values for all allowed header fields.



writeMessagePart
static void writeMessagePart(DataOutputStream dos, MessagePart p) throws IOException(Code)
Writes a message part to the output stream
Parameters:
  dos - the data output stream for writing
Parameters:
  p - the message part to be written
exception:
  IOException - if any I/O errors occur



writeVector
static void writeVector(DataOutputStream dos, Vector v, boolean isAddress) throws IOException(Code)
Writes a vector to an output stream. If the contents are MMS addresses, as indicated by the isAddress parameter, then only the device part of the address is placed into the vector, not the application-id, if any.
Parameters:
  dos - the data output stream for writing
Parameters:
  v - the array to be written
Parameters:
  isAddress - is the contents of the vector an MMS address.
exception:
  IOException - if any I/O errors occur



Fields inherited from com.sun.tck.wma.sms.MessageObject
protected String msgAddress(Code)(Java Doc)
protected String msgType(Code)(Java Doc)
protected long sentAt(Code)(Java Doc)

Methods inherited from com.sun.tck.wma.sms.MessageObject
public String getAddress()(Code)(Java Doc)
public Date getTimestamp()(Code)(Java Doc)
public String getType()(Code)(Java Doc)
public void setAddress(String address)(Code)(Java Doc)
public void setTimeStamp(long timestamp)(Code)(Java Doc)
public void setType(String type)(Code)(Java Doc)

Methods inherited from java.lang.Object
public boolean equals(Object obj)(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.