|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.rim.pushsdk.commons.content.Content
net.rim.pushsdk.commons.content.SinglePartContent
net.rim.pushsdk.commons.content.BinaryContent
public class BinaryContent
Represents binary content, automatically sets the appropriate content type and content transfer encoding header for a binary payload to 'binary'.
If requested, base64 encoding will be done on the binary content and the content transfer encoding header will be set to base64.
| Field Summary | |
|---|---|
static String |
CONTENT_TRANSFER_ENCODING_BASE64
The base64 content transfer encoding. |
static String |
CONTENT_TRANSFER_ENCODING_BINARY
The binary content transfer encoding. |
| Fields inherited from class net.rim.pushsdk.commons.content.Content |
|---|
BOUNDARY_DELIMITER_BYTES, contentType, headers, NEW_LINE, NEW_LINE_BYTES |
| Constructor Summary | |
|---|---|
BinaryContent(byte[] content,
boolean shouldBase64Encode)
Constructs content of a binary type. |
|
BinaryContent(byte[] content,
ContentType contentType,
boolean shouldBase64Encode)
Constructs content of a binary type. |
|
BinaryContent(File file,
boolean shouldBase64Encode)
Constructs content of a binary type from the contents of the file. |
|
BinaryContent(URL url,
boolean shouldBase64Encode)
Constructs content of a binary type from the contents of the URL. |
|
| Method Summary | |
|---|---|
boolean |
isEmpty()
Determines whether the content is empty. |
String |
toString()
Constructs a String with all attributes in name = value format. |
protected void |
writeContentTo(ByteArrayOutputStream out)
Writes content out to the specified output stream. |
| Methods inherited from class net.rim.pushsdk.commons.content.SinglePartContent |
|---|
checkExtension, getBytesFromFile, getBytesFromURL, writeTo |
| 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 |
| Field Detail |
|---|
public static final String CONTENT_TRANSFER_ENCODING_BINARY
public static final String CONTENT_TRANSFER_ENCODING_BASE64
| Constructor Detail |
|---|
public BinaryContent(byte[] content,
boolean shouldBase64Encode)
content - the binary contentshouldBase64Encode - whether content should be base64-encoded
public BinaryContent(byte[] content,
ContentType contentType,
boolean shouldBase64Encode)
content - the binary contentcontentType - type used to set headershouldBase64Encode - whether content should be base64-encoded
public BinaryContent(File file,
boolean shouldBase64Encode)
throws IOException
file - the binary content stored in a fileshouldBase64Encode - whether content should be base64-encoded
IOException
public BinaryContent(URL url,
boolean shouldBase64Encode)
throws IOException
url - the content URLshouldBase64Encode - whether content should be base64-encoded
IOException| Method Detail |
|---|
public String toString()
String with all attributes in name = value format.
toString in class ContentString representation of this object.public boolean isEmpty()
Content
isEmpty in class Content
protected void writeContentTo(ByteArrayOutputStream out)
throws IOException
SinglePartContent
writeContentTo in class SinglePartContentout - the output stream
IOException - if any IO errors occur writing to the output stream
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||