import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_RENDERING;
import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_SIZE;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
+import org.apache.poi.hsmf.MAPIMessage;
+
/**
* Collection of convenence chunks for standard parts of the MSG file attachment.
*/
this.poifsName = poifsName;
}
+
+ /**
+ * Is this Attachment an embedded MAPI message?
+ */
+ public boolean isEmbeddedMessage() {
+ return (attachmentDirectory != null);
+ }
+ /**
+ * Returns the embedded MAPI message, if the attachment
+ * is an embedded message, or null otherwise
+ */
+ public MAPIMessage getEmbeddedMessage() throws IOException {
+ if (attachmentDirectory != null) {
+ return attachmentDirectory.getAsEmbededMessage();
+ }
+ return null;
+ }
+
+ /**
+ * Returns the embedded object, if the attachment is an
+ * object based embedding (image, document etc), or null
+ * if it's an embedded message
+ */
+ public byte[] getEmbeddedAttachmentObject() {
+ if (attachData != null) {
+ return attachData.getValue();
+ }
+ return null;
+ }
+
public Chunk[] getAll() {
return allChunks.toArray(new Chunk[allChunks.size()]);
}