|
||||||||||
| 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.TextContent
public class TextContent
Represents text content. It will automatically set the appropriate content type for a text payload and a charset param if specified.
| Field Summary |
|---|
| Fields inherited from class net.rim.pushsdk.commons.content.Content |
|---|
BOUNDARY_DELIMITER_BYTES, contentType, headers, NEW_LINE, NEW_LINE_BYTES |
| Constructor Summary | |
|---|---|
TextContent(File file)
Constructs content of a text type from the contents of the file. |
|
TextContent(File file,
String characterSet)
Constructs content of a text type from the contents of the file. |
|
TextContent(String content)
Constructs content of a text type. |
|
TextContent(String content,
ContentType contentType)
Constructs content of a text type. |
|
TextContent(String content,
String characterSet)
Constructs content of a text type. |
|
TextContent(URL url)
Constructs content of a text type from the contents of the URL. |
|
| Method Summary | |
|---|---|
protected void |
checkExtension(String string)
Verifies that the file ends in the .txt file extension. |
protected String |
getCharacterSet(URL url)
Gets the character set for the specified URL. |
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)
Note: The text content will be encoded to the specified character set if the content type for this content has a charset parameter. |
| Methods inherited from class net.rim.pushsdk.commons.content.SinglePartContent |
|---|
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 |
| Constructor Detail |
|---|
public TextContent(String content)
content - the textual content
public TextContent(String content,
String characterSet)
content - the textual contentcharacterSet - the character set to encode the textual content
public TextContent(File file)
throws IOException
file - the text content stored in a file
IOException
public TextContent(File file,
String characterSet)
throws IOException
file - the text content stored in a filecharacterSet - the character set to encode the textual content
IOException - if any error occurs regarding the file passed in
public TextContent(URL url)
throws IOException
url - the content URL
IOException
public TextContent(String content,
ContentType contentType)
content - the textual contentcontentType - type used to set header| Method Detail |
|---|
protected void writeContentTo(ByteArrayOutputStream out)
throws IOException
writeContentTo in class SinglePartContentout - the output stream
IOException - if any IO errors occur writing to the output streamprotected void checkExtension(String string)
checkExtension in class SinglePartContentstring - the file name
protected String getCharacterSet(URL url)
throws IOException
url - the URL
IOException - if any IO errors occur reading from the URLpublic boolean isEmpty()
Content
isEmpty in class Contentpublic String toString()
String with all attributes in name = value format.
toString in class ContentString representation of this object.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||