Fields Summary |
---|
public static final int | P_QWell-Known Parameters. |
public static final int | P_CHARSET |
public static final int | P_LEVEL |
public static final int | P_TYPE |
public static final int | P_DEP_NAME |
public static final int | P_DEP_FILENAME |
public static final int | P_DIFFERENCES |
public static final int | P_PADDING |
public static final int | P_CT_MR_TYPE |
public static final int | P_DEP_START |
public static final int | P_DEP_START_INFO |
public static final int | P_DEP_COMMENT |
public static final int | P_DEP_DOMAIN |
public static final int | P_MAX_AGE |
public static final int | P_DEP_PATH |
public static final int | P_SECURE |
public static final int | P_SEC |
public static final int | P_MAC |
public static final int | P_CREATION_DATE |
public static final int | P_MODIFICATION_DATE |
public static final int | P_READ_DATE |
public static final int | P_SIZE |
public static final int | P_NAME |
public static final int | P_FILENAME |
public static final int | P_START |
public static final int | P_START_INFO |
public static final int | P_COMMENT |
public static final int | P_DOMAIN |
public static final int | P_PATH |
public static final int | P_CONTENT_TYPEHeader field names. |
public static final int | P_CONTENT_LOCATION |
public static final int | P_CONTENT_ID |
public static final int | P_DEP_CONTENT_DISPOSITION |
public static final int | P_CONTENT_DISPOSITION |
public static final int | P_CONTENT_TRANSFER_ENCODING |
public static final String | CONTENT_TRANSFER_ENCODINGContent=Transfer-Encoding string. |
public static final String | P_BINARYValue of Content-Transfer-Encoding. |
public static final String | P_7BIT |
public static final String | P_8BIT |
public static final String | P_BASE64 |
public static final String | P_QUOTED_PRINTABLE |
static final byte[] | DISPOSITION_FROM_DATAValue of disposition can be set to PduPart when the value is octet in
the PDU.
"from-data" instead of Form-data.
"attachment" instead of Attachment.
"inline" instead of Inline. |
static final byte[] | DISPOSITION_ATTACHMENT |
static final byte[] | DISPOSITION_INLINE |
public static final int | P_DISPOSITION_FROM_DATAContent-Disposition value. |
public static final int | P_DISPOSITION_ATTACHMENT |
public static final int | P_DISPOSITION_INLINE |
private Map | mPartHeaderHeader of part. |
private android.net.Uri | mUriData uri. |
private byte[] | mPartDataPart data. |
private static final String | TAG |
Methods Summary |
---|
public java.lang.String | generateLocation()
// Assumption: At least one of the content-location / name / filename
// or content-id should be set. This is guaranteed by the PduParser
// for incoming messages and by MM composer for outgoing messages.
byte[] location = (byte[]) mPartHeader.get(P_NAME);
if(null == location) {
location = (byte[]) mPartHeader.get(P_FILENAME);
if (null == location) {
location = (byte[]) mPartHeader.get(P_CONTENT_LOCATION);
}
}
if (null == location) {
byte[] contentId = (byte[]) mPartHeader.get(P_CONTENT_ID);
return "cid:" + new String(contentId);
} else {
return new String(location);
}
|
public int | getCharset()Get Char-set value
Integer charset = (Integer) mPartHeader.get(P_CHARSET);
if(charset == null) {
return 0;
} else {
return charset.intValue();
}
|
public byte[] | getContentDisposition()Get Content-Disposition value.
return (byte[]) mPartHeader.get(P_CONTENT_DISPOSITION);
|
public byte[] | getContentId()Get Content-id value.
return (byte[]) mPartHeader.get(P_CONTENT_ID);
|
public byte[] | getContentLocation()Get Content-Location value.
return (byte[]) mPartHeader.get(P_CONTENT_LOCATION);
|
public byte[] | getContentTransferEncoding()Get Content-Transfer-Encoding value.
return (byte[]) mPartHeader.get(P_CONTENT_TRANSFER_ENCODING);
|
public byte[] | getContentType()Get Content-Type value of part.
return (byte[]) mPartHeader.get(P_CONTENT_TYPE);
|
public byte[] | getData()
if(mPartData == null) {
return null;
}
byte[] byteArray = new byte[mPartData.length];
System.arraycopy(mPartData, 0, byteArray, 0, mPartData.length);
return byteArray;
|
public int | getDataLength()
if(mPartData != null){
return mPartData.length;
} else {
return 0;
}
|
public android.net.Uri | getDataUri()
return mUri;
|
public byte[] | getFilename()Set Content-disposition parameter: filename
return (byte[]) mPartHeader.get(P_FILENAME);
|
public byte[] | getName()Get content-type parameter: name.
return (byte[]) mPartHeader.get(P_NAME);
|
public void | setCharset(int charset)Set Char-set value.
mPartHeader.put(P_CHARSET, charset);
|
public void | setContentDisposition(byte[] contentDisposition)Set Content-Disposition value.
Use PduPart.disposition[0] instead of (Form-data).
Use PduPart.disposition[1] instead of (Attachment).
Use PduPart.disposition[2] instead of (Inline).
if(contentDisposition == null) {
throw new NullPointerException("null content-disposition");
}
mPartHeader.put(P_CONTENT_DISPOSITION, contentDisposition);
|
public void | setContentId(byte[] contentId)Set Content-id value
if((contentId == null) || (contentId.length == 0)) {
throw new IllegalArgumentException(
"Content-Id may not be null or empty.");
}
if ((contentId.length > 1)
&& ((char) contentId[0] == '<")
&& ((char) contentId[contentId.length - 1] == '>")) {
mPartHeader.put(P_CONTENT_ID, contentId);
return;
}
// Insert beginning '<' and trailing '>' for Content-Id.
byte[] buffer = new byte[contentId.length + 2];
buffer[0] = (byte) (0xff & '<");
buffer[buffer.length - 1] = (byte) (0xff & '>");
System.arraycopy(contentId, 0, buffer, 1, contentId.length);
mPartHeader.put(P_CONTENT_ID, buffer);
|
public void | setContentLocation(byte[] contentLocation)Set Content-Location value.
if(contentLocation == null) {
throw new NullPointerException("null content-location");
}
mPartHeader.put(P_CONTENT_LOCATION, contentLocation);
|
public void | setContentTransferEncoding(byte[] contentTransferEncoding)Set Content-Transfer-Encoding value
if(contentTransferEncoding == null) {
throw new NullPointerException("null content-transfer-encoding");
}
mPartHeader.put(P_CONTENT_TRANSFER_ENCODING, contentTransferEncoding);
|
public void | setContentType(byte[] contentType)Set Content-Type value.
if(contentType == null) {
throw new NullPointerException("null content-type");
}
mPartHeader.put(P_CONTENT_TYPE, contentType);
|
public void | setData(byte[] data)Set part data. The data are stored as byte array.
if(data == null) {
return;
}
mPartData = new byte[data.length];
System.arraycopy(data, 0, mPartData, 0, data.length);
|
public void | setDataUri(android.net.Uri uri)Set data uri. The data are stored as Uri.
mUri = uri;
|
public void | setFilename(byte[] fileName)Get Content-disposition parameter: filename
if(null == fileName) {
throw new NullPointerException("null content-id");
}
mPartHeader.put(P_FILENAME, fileName);
|
public void | setName(byte[] name)Set Content-type parameter: name.
if(null == name) {
throw new NullPointerException("null content-id");
}
mPartHeader.put(P_NAME, name);
|