public class MAPIMessage extends POIReadOnlyDocument
Modifier and Type | Class and Description |
---|---|
static class |
MAPIMessage.MESSAGE_CLASS
A MAPI file can be an email (NOTE) or a number of other types
(MAPI 文件可以是电子邮件 (NOTE) 或许多其他类型)
|
Constructor and Description |
---|
MAPIMessage()
Constructor for creating new files.
|
MAPIMessage(DirectoryNode poifsDir)
Constructor for reading MSG Files from a certain point within a POIFS filesystem
|
MAPIMessage(java.io.File file)
Constructor for reading MSG Files from the file system.
|
MAPIMessage(java.io.InputStream in)
Constructor for reading MSG Files from an input stream.
|
MAPIMessage(POIFSFileSystem fs)
Constructor for reading MSG Files from a POIFS filesystem
|
MAPIMessage(java.lang.String filename)
Constructor for reading MSG Files from the file system.
|
Modifier and Type | Method and Description |
---|---|
AttachmentChunks[] |
getAttachmentFiles()
Gets the message attachments.
(获取邮件附件。)
|
java.lang.String |
getConversationTopic()
Gets the conversation topic of the parsed Outlook Message.
(获取已解析 Outlook 邮件的对话主题。)
|
java.lang.String |
getDisplayBCC()
Gets the display value of the "BCC" line of the outlook message.
(获取outlook消息“密件抄送”行的显示值。)
|
java.lang.String |
getDisplayCC()
Gets the display value of the "CC" line of the outlook message.
(获取outlook消息“CC”行的显示值。)
|
java.lang.String |
getDisplayFrom()
Gets the display value of the "FROM" line of the outlook message This is not the actual address that was sent from but the formated display of the user name.
()
|
java.lang.String |
getDisplayTo()
Gets the display value of the "TO" line of the outlook message.
(获取 Outlook 消息的“TO”行的显示值。)
|
java.lang.String[] |
getHeaders()
Returns all the headers, one entry per line
(返回所有标题,每行一个条目)
|
java.lang.String |
getHtmlBody()
Gets the html body of this Outlook Message, if this email contains a html version.
(如果此电子邮件包含 html 版本,则获取此 Outlook 邮件的 html 正文。)
|
Chunks |
getMainChunks()
Gets the main, core details chunks
(获取主要的核心细节块)
|
MAPIMessage.MESSAGE_CLASS |
getMessageClassEnum()
Gets the message class of the parsed Outlook Message.
(获取已分析的 Outlook 邮件的邮件类别。)
|
java.util.Calendar |
getMessageDate()
Gets the date that the message was accepted by the server on.
(获取服务器接受消息的日期。)
|
NameIdChunks |
getNameIdChunks()
Gets the Name ID chunks, or null if there aren't any
(获取名称 ID 块,如果没有,则为 null)
|
RecipientChunks[] |
getRecipientDetailsChunks()
Gets all the recipient details chunks.
(获取所有收件人详细信息块。)
|
java.lang.String |
getRecipientEmailAddress()
Returns all the recipients' email address, separated by semicolons.
(返回所有收件人的电子邮件地址,以分号分隔。)
|
java.lang.String[] |
getRecipientEmailAddressList()
Returns an array of all the recipient's email address, normally in TO then CC then BCC order.
(返回所有收件人电子邮件地址的数组,通常按 TO 然后 CC 然后 BCC 顺序。)
|
java.lang.String |
getRecipientNames()
Returns all the recipients' names, separated by semicolons.
(返回所有收件人的姓名,用分号分隔。)
|
java.lang.String[] |
getRecipientNamesList()
Returns an array of all the recipient's names, normally in TO then CC then BCC order.
(返回所有收件人姓名的数组,通常按 TO 然后 CC 然后 BCC 顺序。)
|
java.lang.String |
getRtfBody()
Gets the RTF Rich Message body of this Outlook Message, if this email contains a RTF (rich) version.
(如果此电子邮件包含 RTF(富)版本,则获取此 Outlook 邮件的 RTF 富消息正文。)
|
java.lang.String |
getStringFromChunk(StringChunk chunk)
Gets a string value based on the passed chunk.
(根据传递的块获取字符串值。)
|
java.lang.String |
getSubject()
Gets the subject line of the Outlook Message
()
|
java.lang.String |
getTextBody()
Gets the plain text body of this Outlook Message
(获取此 Outlook 邮件的纯文本正文)
|
void |
guess7BitEncoding()
Tries to identify the correct encoding for 7-bit (non-unicode) strings in the file.
(尝试识别文件中 7 位(非 unicode)字符串的正确编码。)
|
boolean |
has7BitEncodingStrings()
Does this file contain any strings that are stored as 7 bit rather than unicode?
(此文件是否包含任何存储为 7 位而不是 unicode 的字符串?)
|
boolean |
isReturnNullOnMissingChunk()
Will you get a null on a missing chunk, or a
ChunkNotFoundException (default is the exception).
(你会在丢失的块上得到一个空值,还是一个 ChunkNotFoundException(默认是异常)。)
|
void |
set7BitEncoding(java.lang.String charset)
Many messages store their strings as unicode, which is nice and easy.
(许多消息将其字符串存储为 unicode,这既方便又好用。)
|
void |
set7BitEncoding(java.lang.String generalcharset, java.lang.String htmlbodycharset, java.lang.String bodycharset) |
void |
setReturnNullOnMissingChunk(boolean returnNullOnMissingChunk)
Sets whether on asking for a missing chunk, you get back null or a
ChunkNotFoundException (default is the exception).
(设置是否在请求丢失的块时返回 null 或 ChunkNotFoundException(默认为异常)。)
|
write, write, write
clearDirectory, close, createInformationProperties, getDirectory, getDocumentSummaryInformation, getEncryptedPropertyStreamName, getEncryptionInfo, getPropertySet, getPropertySet, getSummaryInformation, initDirectory, readProperties, replaceDirectory, validateInPlaceWritePossible, writeProperties, writeProperties, writeProperties
public MAPIMessage()
public MAPIMessage(java.lang.String filename) throws java.io.IOException
filename
- Name of the file to read
(filename - 要读取的文件的名称)
java.io.IOException
- on errors reading, or invalid data
(java.io.IOException - 读取错误或无效数据)
public MAPIMessage(java.io.File file) throws java.io.IOException
file
- The file to read from
(file - 要读取的文件)
java.io.IOException
- on errors reading, or invalid data
(java.io.IOException - 读取错误或无效数据)
public MAPIMessage(java.io.InputStream in) throws java.io.IOException
Note - this will buffer the whole message into memory in order to process. For lower memory use, use MAPIMessage(File)
in
- The InputStream to buffer then read from
(in - 要缓冲的 InputStream 然后从中读取)
java.io.IOException
- on errors reading, or invalid data
(java.io.IOException - 读取错误或无效数据)
public MAPIMessage(POIFSFileSystem fs) throws java.io.IOException
fs
- Open POIFS FileSystem containing the message
(fs - 打开包含消息的 POIFS 文件系统)
java.io.IOException
- on errors reading, or invalid data
(java.io.IOException - 读取错误或无效数据)
public MAPIMessage(DirectoryNode poifsDir) throws java.io.IOException
poifsDir
- Directory containing the message
(poifsDir - 包含消息的目录)
java.io.IOException
- on errors reading, or invalid data
(java.io.IOException - 读取错误或无效数据)
public java.lang.String getStringFromChunk(StringChunk chunk) throws ChunkNotFoundException
ChunkNotFoundException
- if the chunk isn't there
(ChunkNotFoundException - 如果块不存在)
public java.lang.String getTextBody() throws ChunkNotFoundException
ChunkNotFoundException
- If the text-body chunk does not exist and returnNullOnMissingChunk is set
(ChunkNotFoundException - 如果 text-body 块不存在并且设置了 returnNullOnMissingChunk)
public java.lang.String getHtmlBody() throws ChunkNotFoundException
ChunkNotFoundException
- If the html-body chunk does not exist and returnNullOnMissingChunk is set
(ChunkNotFoundException - 如果 html-body 块不存在并且设置了 returnNullOnMissingChunk)
public java.lang.String getRtfBody() throws ChunkNotFoundException
ChunkNotFoundException
- If the rtf-body chunk does not exist and returnNullOnMissingChunk is set
(ChunkNotFoundException - 如果 rtf-body 块不存在并且设置了 returnNullOnMissingChunk)
public java.lang.String getSubject() throws ChunkNotFoundException
ChunkNotFoundException
- If the subject-chunk does not exist and returnNullOnMissingChunk is set
(ChunkNotFoundException - 如果主题块不存在并且设置了 returnNullOnMissingChunk)
public java.lang.String getDisplayFrom() throws ChunkNotFoundException
ChunkNotFoundException
- If the from-chunk does not exist and returnNullOnMissingChunk is set
(ChunkNotFoundException - 如果 from-chunk 不存在并且设置了 returnNullOnMissingChunk)
public java.lang.String getDisplayTo() throws ChunkNotFoundException
RecipientChunks
.
(获取 Outlook 消息的“TO”行的显示值。如果有多个收件人,他们将用分号分隔。如果您在电子邮件中单击回复,这不是将发送到的地址/值的实际列表 - 它们存储在 RecipientChunks 中。)
ChunkNotFoundException
- If the to-chunk does not exist and returnNullOnMissingChunk is set
(ChunkNotFoundException - 如果 to-chunk 不存在并且设置了 returnNullOnMissingChunk)
public java.lang.String getDisplayCC() throws ChunkNotFoundException
RecipientChunks
.
(获取outlook消息“CC”行的显示值。 如果有多个收件人,他们将用分号分隔。 如果您单击电子邮件中的回复,这不是将发送到的地址/值的实际列表 - 这些存储在 RecipientChunks 中)
ChunkNotFoundException
- If the cc-chunk does not exist and returnNullOnMissingChunk is set
(ChunkNotFoundException - 如果 cc-chunk 不存在并且设置了 returnNullOnMissingChunk)
public java.lang.String getDisplayBCC() throws ChunkNotFoundException
RecipientChunks
. This will only be present in sent emails, not received ones!
(获取outlook消息“密件抄送”行的显示值。 如果有多个收件人,他们将用分号分隔。 如果您在电子邮件中单击回复,这不是将发送到的地址/值的实际列表 - 它们存储在 RecipientChunks 中。 这只会出现在已发送的电子邮件中,不会出现在收到的电子邮件中!)
ChunkNotFoundException
- If the bcc-chunk does not exist and returnNullOnMissingChunk is set
(ChunkNotFoundException - 如果密件抄送块不存在并且设置了 returnNullOnMissingChunk)
public java.lang.String getRecipientEmailAddress() throws ChunkNotFoundException
ChunkNotFoundException
(ChunkNotFoundException)
public java.lang.String[] getRecipientEmailAddressList() throws ChunkNotFoundException
ChunkNotFoundException
(ChunkNotFoundException)
public java.lang.String getRecipientNames() throws ChunkNotFoundException
getDisplayTo()
,
getDisplayCC()
and
getDisplayBCC()
.
(返回所有收件人的姓名,用分号分隔。检查所有可能的块以搜索名称。另请参见 getDisplayTo()、getDisplayCC() 和 getDisplayBCC()。)
ChunkNotFoundException
(ChunkNotFoundException)
public java.lang.String[] getRecipientNamesList() throws ChunkNotFoundException
getDisplayTo()
,
getDisplayCC()
and
getDisplayBCC()
.
(返回所有收件人姓名的数组,通常按 TO 然后 CC 然后 BCC 顺序。检查所有可能的块以搜索名称。另请参见 getDisplayTo()、getDisplayCC() 和 getDisplayBCC()。)
ChunkNotFoundException
(ChunkNotFoundException)
public void guess7BitEncoding()
Many messages store their strings as unicode, which is nice and easy. Some use one-byte encodings for their strings, but don't always store the encoding anywhere helpful in the file.
This method checks for codepage properties, and failing that looks at the headers for the message, and uses these to guess the correct encoding for your file.
Bug #49441 has more on why this is needed
(尝试识别文件中 7 位(非 unicode)字符串的正确编码。许多消息将其字符串存储为 unicode,这既方便又好用。有些人对其字符串使用单字节编码,但并不总是将编码存储在文件中任何有用的地方。此方法检查代码页属性,失败时查看消息的标头,并使用这些来猜测文件的正确编码。 Bug #49441 有更多关于为什么需要这样做)public void set7BitEncoding(java.lang.String charset)
guess7BitEncoding()
public void set7BitEncoding(java.lang.String generalcharset, java.lang.String htmlbodycharset, java.lang.String bodycharset)
public boolean has7BitEncodingStrings()
public java.lang.String[] getHeaders() throws ChunkNotFoundException
ChunkNotFoundException
(ChunkNotFoundException)
public java.lang.String getConversationTopic() throws ChunkNotFoundException
ChunkNotFoundException
- If the conversation-topic chunk does not exist and returnNullOnMissingChunk is set
(ChunkNotFoundException - 如果会话主题块不存在并且设置了 returnNullOnMissingChunk)
public MAPIMessage.MESSAGE_CLASS getMessageClassEnum() throws ChunkNotFoundException
ChunkNotFoundException
- If the message-class chunk does not exist and returnNullOnMissingChunk is set
(ChunkNotFoundException - 如果消息类块不存在并且设置了 returnNullOnMissingChunk)
public java.util.Calendar getMessageDate() throws ChunkNotFoundException
ChunkNotFoundException
(ChunkNotFoundException)
public Chunks getMainChunks()
public RecipientChunks[] getRecipientDetailsChunks()
getDisplayTo()
* CC recipients, in the order returned by
getDisplayCC()
* BCC recipients, in the order returned by
getDisplayBCC()
(获取所有收件人详细信息块。这些通常按以下顺序排列: * TO 收件人,按 getDisplayTo() 返回的顺序 * CC 收件人,按 getDisplayCC() 返回的顺序 * BCC 收件人,按 getDisplayBCC() 返回的顺序)
public NameIdChunks getNameIdChunks()
public AttachmentChunks[] getAttachmentFiles()
public boolean isReturnNullOnMissingChunk()
ChunkNotFoundException
(default is the exception).
(你会在丢失的块上得到一个空值,还是一个 ChunkNotFoundException(默认是异常)。)
public void setReturnNullOnMissingChunk(boolean returnNullOnMissingChunk)
ChunkNotFoundException
(default is the exception).
(设置是否在请求丢失的块时返回 null 或 ChunkNotFoundException(默认为异常)。)
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.