com.aspose.email

Interfaces

Classes

Enums

Exceptions

com.aspose.email

Class MboxStorageReader

    • Field Detail

      • FromMarker

        protected static final byte[] FromMarker

        "From " signature, indicates a start of the message.

      • EmptyFromMarkerCRLF

        protected static final byte[] EmptyFromMarkerCRLF
      • EmptyFromMarkerCR

        protected static final byte[] EmptyFromMarkerCR
      • EmptyFromMarkerLF

        protected static final byte[] EmptyFromMarkerLF
      • MboxoMarker

        protected static final byte[] MboxoMarker

        The mbox format uses a single blank line followed by the string 'From ' (with a space) to delimit messages. In mboxo format sender's email address in message delimiter is replaced by the constant string '???@???', i.e. 'From ???@???'

    • Constructor Detail

      • MboxStorageReader

        protected MboxStorageReader(InputStream stream,
                         boolean leaveOpen)

        Initializes a new instance of the MboxStorageReader class.

        Parameters:
        stream - The stream.
        leaveOpen - if set to true leaves the underlying stream open after disposing.
        Throws:
        com.aspose.ms.System.ArgumentNullException - If given stream is null.
      • MboxStorageReader

        protected MboxStorageReader(String fileName,
                         boolean leaveOpen)

        Initializes a new instance of the MboxStorageReader class.

        Parameters:
        fileName - Name of the file.
        leaveOpen - if set to true leaves the underlying stream open after disposing.
        Throws:
        com.aspose.ms.System.ArgumentNullException - If filename is null or empty.
    • Method Detail

      • getBaseStream

        @Deprecated
        public InputStream getBaseStream()
        Deprecated. 

        Gets the base stream.

        Value: The base stream.
      • getCurrentDataSize

        public final long getCurrentDataSize()

        Gets the number of bytes that is read by ReadNextMessage method.

      • setCurrentDataSize

        protected final void setCurrentDataSize(long value)

        Gets the number of bytes that is read by ReadNextMessage method.

      • createReader

        public static MboxStorageReader createReader(InputStream stream,
                                     boolean leaveOpen)

        Creates the instance of reader.

        Parameters:
        stream -
        leaveOpen -
        Returns:
        Throws:
        com.aspose.ms.System.ArgumentNullException
      • createReader

        public static MboxStorageReader createReader(String fileName,
                                     boolean leaveOpen)

        Creates the instance of reader.

        Parameters:
        fileName -
        leaveOpen -
        Returns:
        Throws:
        com.aspose.ms.System.ArgumentNullException
      • readNextMessage

        public abstract MailMessage readNextMessage()

        Reads the next message from underlying storage stream.

        Returns:
        A MailMessage object if it can be read or <b>null</b> if no more messages are available.
      • readNextMessage

        public abstract MailMessage readNextMessage(String[] fromMarker)

        Reads the next message from underlying storage stream.

        Parameters:
        fromMarker - Gets the From Marker while parsing the MBox Storage file.
        Returns:
        A MailMessage object if it can be read or <b>null</b> if no more messages are available.
      • getTotalItemsCount

        public abstract int getTotalItemsCount()

        Returns the number of messages in a storage.

        Returns:
        Returns the number of messages in a storage.
      • dispose

        public final void dispose()

        Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

        Specified by:
        dispose in interface com.aspose.ms.System.IDisposable
      • dispose

        protected void dispose(boolean disposing)

        Releases unmanaged and - optionally - managed resources

        Parameters:
        disposing - true to release both managed and unmanaged resources; false to release only unmanaged resources.
      • byteArrayStartsFromMarker

        protected static boolean byteArrayStartsFromMarker(byte[] array,
                                        byte[] marker)

        Checks whether the array starts from given marker.

        Parameters:
        array - The array, can be null.
        marker - The marker, can't be null.
        Returns:
        Boolean value indicating the result of operation.
      • readLine

        protected static byte[] readLine(com.aspose.ms.System.IO.Stream stream)

        Reads the line from stream.

        Parameters:
        stream - The stream.
        Returns:
        The line read.