com.groupdocs.parser

Interfaces

Classes

Exceptions

com.groupdocs.parser

Class EmailTextExtractorBase

    • Constructor Detail

      • EmailTextExtractorBase

        protected EmailTextExtractorBase(InputStream stream,
                              LoadOptions loadOptions)

        Initializes a new instance of the EmailTextExtractorBase class.

        Parameters:
        stream - The stream of the document.
        loadOptions - The options of loading the file.
    • Method Detail

      • getAttachmentCount

        public int getAttachmentCount()

        Gets a total count of the attachments.

        Returns:
        A total count of the attachments.
      • getEntities

        public List<Container.Entity> getEntities()

        Gets a collection of email attachments.

        Value: A collection of email attachments.
         // Create an extractor factory
         ExtractorFactory factory = new ExtractorFactory();
         // Create an instance of EmailTextExtractor class
         EmailTextExtractor extractor = new EmailTextExtractor(fileName);
         // Iterate over all attachments in the message
         for (int i = 0; i &lt; extractor.getEntities().size(); i++) {
             // Print the name of an attachment
             System.out.println(extractor.getEntities().get(i).getName());
             // Open the stream of an attachment
             java.io.InputStream stream = extractor.getEntities().get(i).openStream();
             // Create the text extractor for an attachment
             TextExtractor attachmentExtractor = factory.createTextExtractor(stream);
             // If a media type is supported
             if (attachmentExtractor != null)
                 // Print the content of an attachment
                 System.out.println(attachmentExtractor.extractAll());
         }
          
        Specified by:
        getEntities in interface IContainer
        Returns:
        A collection of container's entities.
      • openEntityStream

        public InputStream openEntityStream(Container.Entity entity)

        Opens a stream with the content of the container's entity.

        Specified by:
        openEntityStream in interface IContainer
        Parameters:
        entity - A container's entity.
        Returns:
        A stream with the content of the container's entity.
      • getStream

        public InputStream getStream(int attachment)

        Returns a java.io.InputStream with a content of the attachment.

        Parameters:
        attachment - An index of the attachment.
        Returns:
        A java.io.InputStream with a content of the attachment.
      • reset

        public void reset()

        Resets the current document.


        Resets the cursor's position. ExtractLine method will return the first line of the document.

        Overrides:
        reset in class TextExtractor
      • prepareLine

        protected String prepareLine()

        Returns a line of the text.

        Specified by:
        prepareLine in class TextExtractor
        Returns:
        A string that represents a line of the text, or null if all characters have been read.
      • dispose

        protected void dispose(boolean disposing)

        Releases the unmanaged resources used by the extractor.

        Overrides:
        dispose in class TextExtractor
        Parameters:
        disposing - A boolean true if invoked from Dispose; otherwise, false.