Methods Summary |
---|
public boolean | addPart(PduPart part)Appends the specified part to the end of this body.
if(null == part) {
throw new NullPointerException();
}
putPartToMaps(part);
return mParts.add(part);
|
public void | addPart(int index, PduPart part)Inserts the specified part at the specified position.
if(null == part) {
throw new NullPointerException();
}
putPartToMaps(part);
mParts.add(index, part);
|
public PduPart | getPart(int index)Get the part at the specified position.
return mParts.get(index);
|
public PduPart | getPartByContentId(java.lang.String cid)Get pdu part by content id.
return mPartMapByContentId.get(cid);
|
public PduPart | getPartByContentLocation(java.lang.String contentLocation)Get pdu part by Content-Location. Content-Location of part is
the same as filename and name(param of content-type).
return mPartMapByContentLocation.get(contentLocation);
|
public PduPart | getPartByFileName(java.lang.String filename)Get pdu part by filename.
return mPartMapByFileName.get(filename);
|
public PduPart | getPartByName(java.lang.String name)Get pdu part by name.
return mPartMapByName.get(name);
|
public int | getPartIndex(PduPart part)Get the index of the specified part.
return mParts.indexOf(part);
|
public int | getPartsNum()Get the number of parts.
return mParts.size();
|
private void | putPartToMaps(PduPart part)
// Put part to mPartMapByContentId.
byte[] contentId = part.getContentId();
if(null != contentId) {
mPartMapByContentId.put(new String(contentId), part);
}
// Put part to mPartMapByContentLocation.
byte[] contentLocation = part.getContentLocation();
if(null != contentLocation) {
String clc = new String(contentLocation);
mPartMapByContentLocation.put(clc, part);
}
// Put part to mPartMapByName.
byte[] name = part.getName();
if(null != name) {
String clc = new String(name);
mPartMapByName.put(clc, part);
}
// Put part to mPartMapByFileName.
byte[] fileName = part.getFilename();
if(null != fileName) {
String clc = new String(fileName);
mPartMapByFileName.put(clc, part);
}
|
public void | removeAll()Remove all of the parts.
mParts.clear();
|
public PduPart | removePart(int index)Removes the part at the specified position.
return mParts.remove(index);
|