本文整理汇总了Java中org.apache.poi.hsmf.MAPIMessage类的典型用法代码示例。如果您正苦于以下问题:Java MAPIMessage类的具体用法?Java MAPIMessage怎么用?Java MAPIMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MAPIMessage类属于org.apache.poi.hsmf包,在下文中一共展示了MAPIMessage类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: extractText
import org.apache.poi.hsmf.MAPIMessage; //导入依赖的package包/类
/**
* {@inheritDoc} Returns an empty reader if an error occured extracting text from
* the outlook message.
*/
public String extractText(InputStream stream, String type, String encoding) throws IOException {
try {
MAPIMessage message = new MAPIMessage(stream);
StringBuffer buffer = new StringBuffer();
buffer.append(message.getDisplayFrom()).append('\n');
buffer.append(message.getDisplayTo()).append('\n');
buffer.append(message.getSubject()).append('\n');
buffer.append(message.getTextBody());
return buffer.toString();
} catch (Exception e) {
logger.warn("Failed to extract Message content", e);
throw new IOException(e.getMessage(), e);
} finally {
stream.close();
}
}
示例2: OutlookExtractor
import org.apache.poi.hsmf.MAPIMessage; //导入依赖的package包/类
public OutlookExtractor(DirectoryNode root, ParseContext context) throws TikaException {
super(context);
try {
this.msg = new MAPIMessage(root);
} catch (IOException e) {
throw new TikaException("Failed to parse Outlook message", e);
}
}
示例3: main
import org.apache.poi.hsmf.MAPIMessage; //导入依赖的package包/类
public static void main(String[] args) throws Exception
{
String filename = "data/message.msg";
MAPIMessage msg = new MAPIMessage(filename);
PrintWriter txtOut = new PrintWriter("data/ApacheMessage.txt");
txtOut.println("Email Body: " + msg.getTextBody());
txtOut.close();
}
示例4: main
import org.apache.poi.hsmf.MAPIMessage; //导入依赖的package包/类
public static void main(String[] args) throws Exception
{
MAPIMessage msg = new MAPIMessage("data/message.msg");
AttachmentChunks[] attachments = msg.getAttachmentFiles();
if (attachments.length > 0)
{
File d = new File("data/attachments");
if (d.exists() || d.mkdir())
{
for (AttachmentChunks attachment : attachments)
{
String fileName = attachment.attachFileName.toString();
if (attachment.attachLongFileName != null)
{
fileName = attachment.attachLongFileName.toString();
}
File f = new File(d, fileName);
OutputStream fileOut = null;
try
{
fileOut = new FileOutputStream(f);
fileOut.write(attachment.attachData.getValue());
}
finally
{
if (fileOut != null)
{
fileOut.close();
}
}
}
}
}
System.out.println("Done ...");
}
示例5: main
import org.apache.poi.hsmf.MAPIMessage; //导入依赖的package包/类
public static void main(String[] args) throws Exception
{
MAPIMessage msg = new MAPIMessage("data/message.msg");
System.out.println("From: " + msg.getDisplayFrom());
System.out.println("To: " + msg.getDisplayTo());
System.out.println("CC: " + msg.getDisplayCC());
System.out.println("BCC: " + msg.getDisplayBCC());
System.out.println("Subject: " + msg.getSubject());
}
示例6: getEmbeddedMessage
import org.apache.poi.hsmf.MAPIMessage; //导入依赖的package包/类
/**
* 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;
}
示例7: parseContent
import org.apache.poi.hsmf.MAPIMessage; //导入依赖的package包/类
@Override
protected void parseContent(StreamLimiter streamLimiter, LanguageEnum lang) throws IOException {
MAPIMessage msg = new MAPIMessage(streamLimiter.getNewInputStream());
msg.setReturnNullOnMissingChunk(true);
ParserResultItem result = getNewParserResultItem();
try {
result.addField(ParserFieldEnum.email_display_from, msg.getDisplayFrom());
result.addField(ParserFieldEnum.email_display_to, msg.getDisplayTo());
result.addField(ParserFieldEnum.email_display_cc, msg.getDisplayCC());
result.addField(ParserFieldEnum.email_display_bcc, msg.getDisplayBCC());
result.addField(ParserFieldEnum.subject, msg.getSubject());
result.addField(ParserFieldEnum.htmlSource, msg.getHtmlBody());
result.addField(ParserFieldEnum.content, msg.getTextBody());
result.addField(ParserFieldEnum.creation_date, msg.getMessageDate());
result.addField(ParserFieldEnum.email_conversation_topic, msg.getConversationTopic());
RecipientChunks[] recipientChuncksList = msg.getRecipientDetailsChunks();
if (recipientChuncksList != null) {
for (RecipientChunks recipientChunks : recipientChuncksList) {
result.addField(ParserFieldEnum.email_recipient_name, recipientChunks.getRecipientName());
result.addField(ParserFieldEnum.email_recipient_address,
recipientChunks.getRecipientEmailAddress());
}
}
if (StringUtils.isEmpty(msg.getHtmlBody()))
result.langDetection(10000, ParserFieldEnum.content);
else
result.langDetection(10000, ParserFieldEnum.htmlSource);
} catch (ChunkNotFoundException e) {
Logging.warn(e);
}
}
示例8: main
import org.apache.poi.hsmf.MAPIMessage; //导入依赖的package包/类
public static void main(String[] args) throws Exception
{
String filename = "data/message.msg";
MAPIMessage msg = new MAPIMessage(filename);
}
示例9: main
import org.apache.poi.hsmf.MAPIMessage; //导入依赖的package包/类
public static void main(String[] args) throws Exception
{
MAPIMessage msg = new MAPIMessage("data/message.msg");
System.out.println("Text Body:"+ msg.getTextBody());
}
示例10: OutlookTextExtactor
import org.apache.poi.hsmf.MAPIMessage; //导入依赖的package包/类
public OutlookTextExtactor(MAPIMessage msg) {
super(msg);
}
示例11: getMAPIMessage
import org.apache.poi.hsmf.MAPIMessage; //导入依赖的package包/类
/**
* Returns the underlying MAPI message
*/
public MAPIMessage getMAPIMessage() {
return (MAPIMessage)document;
}
示例12: getAsEmbededMessage
import org.apache.poi.hsmf.MAPIMessage; //导入依赖的package包/类
/**
* Treats the directory as an embeded MAPIMessage
* (it normally is one), and returns a MAPIMessage
* object to process it with.
*/
public MAPIMessage getAsEmbededMessage() throws IOException {
return new MAPIMessage(dir);
}