public final class PersonalStorageContainer extends Container
Provides a container for Outlook's Personal Storage.
Enumerate all messages in the file:
// Create a container for Outlook's Personal Storage
IContainer container = new PersonalStorageContainer(stream);
// Iterate items
for (int i = 0; i < container.getEntities().size(); i++) {
System.out.println("Name: " + container.getEntities().get(i)
.getName()); // the ID of the entity
System.out.println("Path: " + container.getEntities().get(i)
.getPath().toString()); // path in the container
System.out.println("Media type: " + container.getEntities().get(i)
.getMediaType()); // media type (for example: APPLICATION/VND.MS-OUTLOOK)
System.out.println("Subject: " + container.getEntities().get(i)
.get_Item(MetadataNames.SUBJECT)); // email's subject
System.out.println("" + container.getEntities().get(i)
.get_Item(MetadataNames.EMAIL_FROM)); // email's sender (field 'from')
System.out.println("" + container.getEntities().get(i)
.get_Item(MetadataNames.EMAIL_TO)); // email's receiver (field 'to')
}
Read the concrete message:
// Create a container for Outlook's Personal Storage
IContainer container = new PersonalStorageContainer(stream);
// Create an extractor for the email
EmailTextExtractor extractor = new EmailTextExtractor(container.getEntities().get(messageIndex).openStream());
// Extract a text from the email
System.out.println(extractor == null ? "document isn't supported" : extractor.extractAll());
Container.Entity, Container.EntityParameter
Constructor and Description |
---|
PersonalStorageContainer(InputStream stream)
Initializes a new instance of the
PersonalStorageContainer class. |
PersonalStorageContainer(String fileName)
Initializes a new instance of the
PersonalStorageContainer class. |
Modifier and Type | Method and Description |
---|---|
protected void |
dispose(boolean disposing)
Releases the unmanaged resources used by the container.
|
protected List<Container.Entity> |
loadEntities()
Returns a collection of the container's entities.
|
protected InputStream |
openStream(Container.Entity entity)
Returns the stream with the content of the
entity . |
close, dispose, getContainerStream, getEncoding, getEntities, getMediaType, load, openEntityStream, setEncoding, setMediaType
public PersonalStorageContainer(String fileName)
Initializes a new instance of the PersonalStorageContainer
class.
fileName
- The path to the file.public PersonalStorageContainer(InputStream stream)
Initializes a new instance of the PersonalStorageContainer
class.
stream
- The stream of the document.protected void dispose(boolean disposing)
Releases the unmanaged resources used by the container.
protected InputStream openStream(Container.Entity entity)
Returns the stream with the content of the entity
.
openStream
in class Container
entity
- The entity.java.io.InputStream
with the content of the entity.protected List<Container.Entity> loadEntities()
Returns a collection of the container's entities.
loadEntities
in class Container