net.rim.pushsdk.commons.content
Class MultiPartContent

java.lang.Object
  extended by net.rim.pushsdk.commons.content.Content
      extended by net.rim.pushsdk.commons.content.MultiPartContent

public class MultiPartContent
extends Content

Represents multi-part message body content.

Author:
mdandrea

Field Summary
 
Fields inherited from class net.rim.pushsdk.commons.content.Content
BOUNDARY_DELIMITER_BYTES, contentType, headers, NEW_LINE, NEW_LINE_BYTES
 
Constructor Summary
MultiPartContent()
          Constructs multi-part content.
MultiPartContent(BoundaryGenerator boundaryGenerator)
          Constructs multi-part content.
 
Method Summary
 void addPart(Content part)
          Adds a content part.
 String getBoundary()
          Gets the boundary.
 List<Content> getParts()
          Gets the content parts.
 boolean isEmpty()
          Determines whether the content is empty.
 void setParts(List<Content> parts)
          Sets the content parts.
 String toString()
          Constructs a String with all attributes in name = value format.
 void writeTo(ByteArrayOutputStream out)
          Writes the content to the specified output stream.
 
Methods inherited from class net.rim.pushsdk.commons.content.Content
addHeader, getContentType, getHeader, getHeaders, setContentType, setHeader, writeHeadersTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MultiPartContent

public MultiPartContent()
Constructs multi-part content.


MultiPartContent

public MultiPartContent(BoundaryGenerator boundaryGenerator)
Constructs multi-part content. A boundary generator can be specified to override how the boundary is formatted.

Parameters:
boundaryGenerator - a boundary generator that will be used to generate the boundaries that separate the pieces of content
Method Detail

getParts

public List<Content> getParts()
Gets the content parts.

Returns:
a list of content parts

setParts

public void setParts(List<Content> parts)
Sets the content parts.

Parameters:
parts - a list of content parts

addPart

public void addPart(Content part)
Adds a content part.

Parameters:
part - the content part

getBoundary

public String getBoundary()
Gets the boundary.

Returns:
the boundary

writeTo

public void writeTo(ByteArrayOutputStream out)
             throws IOException
Description copied from class: Content
Writes the content to the specified output stream.

Specified by:
writeTo in class Content
Parameters:
out - the output stream
Throws:
IOException - if any IO errors occur

isEmpty

public boolean isEmpty()
Description copied from class: Content
Determines whether the content is empty.

Specified by:
isEmpty in class Content
Returns:
true if the content is deemed to be empty; false otherwise

toString

public String toString()
Constructs a String with all attributes in name = value format.

Overrides:
toString in class Content
Returns:
a String representation of this object.


Copyright © 2011 Research In Motion. All Rights Reserved.