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

        @Deprecated
        protected MboxStorageReader(InputStream stream,
                                    boolean leaveOpen)
        Deprecated. This ctor is obsolete and will be removed soon. Please use ctor with MboxLoadOptions

        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

        @Deprecated
        protected MboxStorageReader(com.aspose.ms.System.IO.Stream stream,
                                    boolean leaveOpen)
        Deprecated. This ctor is obsolete and will be removed soon. Please use ctor with MboxLoadOptions

        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

        @Deprecated
        protected MboxStorageReader(String fileName,
                                    boolean leaveOpen)
        Deprecated. This ctor is obsolete and will be removed soon. Please use ctor with MboxLoadOptions

        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.
      • MboxStorageReader

        protected MboxStorageReader(InputStream stream,
                         MboxLoadOptions options)

        Initializes a new instance of the MboxStorageReader class.

        Parameters:
        stream - The stream.
        options - additional options when loading a Mbox storageMboxLoadOptions.
        Throws:
        com.aspose.ms.System.ArgumentNullException - If given stream is null.
      • MboxStorageReader

        protected MboxStorageReader(com.aspose.ms.System.IO.Stream stream,
                         MboxLoadOptions options)

        Initializes a new instance of the MboxStorageReader class.

        Parameters:
        stream - The stream.
        options - additional options when loading a Mbox storageMboxLoadOptions.
        Throws:
        com.aspose.ms.System.ArgumentNullException - If given stream is null.
      • MboxStorageReader

        protected MboxStorageReader(String fileName,
                         MboxLoadOptions options)

        Initializes a new instance of the MboxStorageReader class.

        Parameters:
        fileName - Name of the file.
        options - additional options when loading a Mbox storageMboxLoadOptions.
        Throws:
        com.aspose.ms.System.ArgumentNullException - If filename is null or empty.
    • Method Detail

      • 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

        @Deprecated
        public static MboxStorageReader createReader(InputStream stream,
                                                boolean leaveOpen)
        Deprecated. This method is obsolete and will be removed soon. Please use method with MboxLoadOptions

        Creates the instance of reader.

        Parameters:
        stream - The stream.
        leaveOpen - if set to true leaves the underlying stream open after disposing.
        Returns:
        Throws:
        com.aspose.ms.System.ArgumentNullException
      • createReader

        @Deprecated
        public static MboxStorageReader createReader(com.aspose.ms.System.IO.Stream stream,
                                                boolean leaveOpen)
        Deprecated. This method is obsolete and will be removed soon. Please use method with MboxLoadOptions

        Creates the instance of reader.

        Parameters:
        stream - The stream.
        leaveOpen - if set to true leaves the underlying stream open after disposing.
        Returns:
        Throws:
        com.aspose.ms.System.ArgumentNullException
      • createReader

        public static MboxStorageReader createReader(InputStream stream,
                                     MboxLoadOptions options)

        Creates the instance of reader.

        Parameters:
        stream - The stream.
        options - additional options when loading a Mbox storageMboxLoadOptions.
        Returns:
        Throws:
        com.aspose.ms.System.ArgumentNullException
      • createReader

        public static MboxStorageReader createReader(com.aspose.ms.System.IO.Stream stream,
                                     MboxLoadOptions options)

        Creates the instance of reader.

        Parameters:
        stream - The stream.
        options - additional options when loading a Mbox storageMboxLoadOptions.
        Returns:
        Throws:
        com.aspose.ms.System.ArgumentNullException
      • createReader

        @Deprecated
        public static MboxStorageReader createReader(String fileName,
                                                boolean leaveOpen)
        Deprecated. This method is obsolete and will be removed soon. Please use method with MboxLoadOptions

        Creates the instance of reader.

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

        public static MboxStorageReader createReader(String fileName,
                                     MboxLoadOptions options)

        Creates the instance of reader.

        Parameters:
        fileName -
        options - additional options when loading a Mbox storageMboxLoadOptions.
        Returns:
        Throws:
        com.aspose.ms.System.ArgumentNullException
      • enumerateMessages

        public final com.aspose.ms.System.Collections.Generic.IGenericEnumerable<MailMessage> enumerateMessages()

        Exposes the enumerator, which supports an iteration of messages in storage.

        Returns:
        System.Collections.Generic.IEnumerableltTgt, that represents an enumerator that iterates through a messages in storage.
      • 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.