|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.rim.pushsdk.commons.content.Content
public abstract class Content
Abstract class that all types of content must extend.
| Field Summary | |
|---|---|
static byte[] |
BOUNDARY_DELIMITER_BYTES
The boundary delimiter in bytes (i.e. |
protected ContentType |
contentType
The content type. |
protected HttpHeaderList |
headers
The HTTP headers. |
static String |
NEW_LINE
The new-line character (i.e. |
static byte[] |
NEW_LINE_BYTES
The new-line character in bytes (i.e. |
| Constructor Summary | |
|---|---|
Content()
|
|
| Method Summary | |
|---|---|
void |
addHeader(String headerName,
String headerValue)
Adds a header; if a header with the same name already exists, the value will be added to the list of existing values. |
ContentType |
getContentType()
Gets the content type. |
String |
getHeader(String headerName)
Gets the first header value for the given header name. |
List<String> |
getHeaders(String headerName)
Gets the header values for the given header name. |
abstract boolean |
isEmpty()
Determines whether the content is empty. |
void |
setContentType(ContentType contentType)
Sets the content type. |
void |
setHeader(String headerName,
String headerValue)
Adds a header; if a header with the same name already exists, the value(s) will be replaced with the one specified here. |
String |
toString()
Constructs a String with all attributes in name = value format. |
void |
writeHeadersTo(ByteArrayOutputStream out)
Writes the headers to the specified output stream. |
abstract void |
writeTo(ByteArrayOutputStream out)
Writes the content to the specified output stream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final byte[] BOUNDARY_DELIMITER_BYTES
public static final byte[] NEW_LINE_BYTES
public static final String NEW_LINE
protected ContentType contentType
protected HttpHeaderList headers
| Constructor Detail |
|---|
public Content()
| Method Detail |
|---|
public ContentType getContentType()
public void setContentType(ContentType contentType)
contentType - the content type
public void setHeader(String headerName,
String headerValue)
headerName - the header nameheaderValue - the header value
public void addHeader(String headerName,
String headerValue)
headerName - the header nameheaderValue - the header valuepublic String getHeader(String headerName)
headerName - the header name
public List<String> getHeaders(String headerName)
headerName - the header name
public void writeHeadersTo(ByteArrayOutputStream out)
throws IOException
out - the output stream
IOException - if any IO errors occur
public abstract void writeTo(ByteArrayOutputStream out)
throws IOException
out - the output stream
IOException - if any IO errors occurpublic abstract boolean isEmpty()
public String toString()
String with all attributes in name = value format.
toString in class ObjectString representation of this object.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||