public abstract class MboxStorageReader extends Object implements IDisposable, Closeable
A base class for any mbox-based mail storage reader.
| Modifier and Type | Field and Description |
|---|---|
protected static byte[] |
EmptyFromMarkerCR |
protected static byte[] |
EmptyFromMarkerCRLF |
protected static byte[] |
EmptyFromMarkerLF |
protected static byte[] |
FromMarker
"From " signature, indicates a start of the message.
|
protected static byte[] |
MboxoMarker
The mbox format uses a single blank line followed by the string 'From ' (with a space) to delimit messages.
|
protected Encoding |
preferredTextEncoding |
| Modifier | Constructor and Description |
|---|---|
protected |
MboxStorageReader(InputStream stream,
boolean leaveOpen)
Deprecated.
This ctor is obsolete and will be removed soon. Please use ctor with MboxLoadOptions
|
protected |
MboxStorageReader(InputStream stream,
MboxLoadOptions options)
Initializes a new instance of the
MboxStorageReader class. |
protected |
MboxStorageReader(Stream stream,
boolean leaveOpen)
Deprecated.
This ctor is obsolete and will be removed soon. Please use ctor with MboxLoadOptions
|
protected |
MboxStorageReader(Stream stream,
MboxLoadOptions options)
Initializes a new instance of the
MboxStorageReader class. |
protected |
MboxStorageReader(String fileName,
boolean leaveOpen)
Deprecated.
This ctor is obsolete and will be removed soon. Please use ctor with MboxLoadOptions
|
protected |
MboxStorageReader(String fileName,
MboxLoadOptions options)
Initializes a new instance of the
MboxStorageReader class. |
| Modifier and Type | Method and Description |
|---|---|
protected static boolean |
byteArrayStartsFromMarker(byte[] array,
byte[] marker)
Checks whether the array starts from given marker.
|
void |
close() |
protected static boolean |
containsAsctime(byte[] currentLine)
Determines whether the specified line contains asctime string.
|
static MboxStorageReader |
createReader(InputStream stream,
boolean leaveOpen)
Deprecated.
This method is obsolete and will be removed soon. Please use method with MboxLoadOptions
|
static MboxStorageReader |
createReader(InputStream stream,
MboxLoadOptions options)
Creates the instance of reader.
|
static MboxStorageReader |
createReader(Stream stream,
boolean leaveOpen)
Deprecated.
This method is obsolete and will be removed soon. Please use method with MboxLoadOptions
|
static MboxStorageReader |
createReader(Stream stream,
MboxLoadOptions options)
Creates the instance of reader.
|
static MboxStorageReader |
createReader(String fileName,
boolean leaveOpen)
Deprecated.
This method is obsolete and will be removed soon. Please use method with MboxLoadOptions
|
static MboxStorageReader |
createReader(String fileName,
MboxLoadOptions options)
Creates the instance of reader.
|
void |
dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
|
protected void |
dispose(boolean disposing)
Releases unmanaged and - optionally - managed resources
|
IGenericEnumerable<MboxMessageInfo> |
enumerateMessageInfo()
Exposes the enumerator, which supports an iteration of messages in storage.
|
IGenericEnumerable<MailMessage> |
enumerateMessages()
Exposes the enumerator, which supports an iteration of messages in storage.
|
IGenericEnumerable<MailMessage> |
enumerateMessages(EmlLoadOptions options)
Exposes the enumerator, which supports an iteration of messages in storage.
|
MailMessage |
extractMessage(String id,
EmlLoadOptions options)
Get the message from MBOX.
|
long |
getCurrentDataSize()
Gets the number of bytes that is read by ReadNextMessage method.
|
abstract int |
getTotalItemsCount()
Returns the number of messages in a storage.
|
abstract MboxMessageInfo |
nextMessage()
Gets the next message info.
|
protected static byte[] |
readLine(Stream stream)
Reads the line from stream.
|
abstract MailMessage |
readNextMessage()
Reads the next message from underlying storage stream.
|
abstract MailMessage |
readNextMessage(EmlLoadOptions options)
Reads the next message from underlying storage stream.
|
abstract MailMessage |
readNextMessage(String[] fromMarker)
Reads the next message from underlying storage stream.
|
abstract MailMessage |
readNextMessage(String[] fromMarker,
EmlLoadOptions options)
Reads the next message from underlying storage stream.
|
protected void |
setCurrentDataSize(long value)
Gets the number of bytes that is read by ReadNextMessage method.
|
protected final Encoding preferredTextEncoding
protected static final byte[] FromMarker
"From " signature, indicates a start of the message.
protected static final byte[] EmptyFromMarkerCRLF
protected static final byte[] EmptyFromMarkerCR
protected static final byte[] EmptyFromMarkerLF
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 ???@???'
@Deprecated protected MboxStorageReader(InputStream stream, boolean leaveOpen)
Initializes a new instance of the MboxStorageReader class.
stream - The stream.leaveOpen - if set to true leaves the underlying stream open after disposing.ArgumentNullException - If given stream is null.@Deprecated protected MboxStorageReader(Stream stream, boolean leaveOpen)
Initializes a new instance of the MboxStorageReader class.
stream - The stream.leaveOpen - if set to true leaves the underlying stream open after disposing.ArgumentNullException - If given stream is null.@Deprecated protected MboxStorageReader(String fileName, boolean leaveOpen)
Initializes a new instance of the MboxStorageReader class.
fileName - Name of the file.leaveOpen - if set to true leaves the underlying stream open after disposing.ArgumentNullException - If filename is null or empty.protected MboxStorageReader(InputStream stream, MboxLoadOptions options)
Initializes a new instance of the MboxStorageReader class.
stream - The stream.options - additional options when loading a Mbox storageMboxLoadOptions.ArgumentNullException - If given stream is null.protected MboxStorageReader(Stream stream,
MboxLoadOptions options)
Initializes a new instance of the MboxStorageReader class.
stream - The stream.options - additional options when loading a Mbox storageMboxLoadOptions.ArgumentNullException - If given stream is null.protected MboxStorageReader(String fileName, MboxLoadOptions options)
Initializes a new instance of the MboxStorageReader class.
fileName - Name of the file.options - additional options when loading a Mbox storageMboxLoadOptions.ArgumentNullException - If filename is null or empty.public final long getCurrentDataSize()
Gets the number of bytes that is read by ReadNextMessage method.
protected final void setCurrentDataSize(long value)
Gets the number of bytes that is read by ReadNextMessage method.
@Deprecated public static MboxStorageReader createReader(InputStream stream, boolean leaveOpen)
Creates the instance of reader.
stream - The stream.leaveOpen - if set to true leaves the underlying stream open after disposing.ArgumentNullException@Deprecated public static MboxStorageReader createReader(Stream stream, boolean leaveOpen)
Creates the instance of reader.
stream - The stream.leaveOpen - if set to true leaves the underlying stream open after disposing.ArgumentNullExceptionpublic static MboxStorageReader createReader(InputStream stream, MboxLoadOptions options)
Creates the instance of reader.
stream - The stream.options - additional options when loading a Mbox storageMboxLoadOptions.ArgumentNullExceptionpublic static MboxStorageReader createReader(Stream stream, MboxLoadOptions options)
Creates the instance of reader.
stream - The stream.options - additional options when loading a Mbox storageMboxLoadOptions.ArgumentNullException@Deprecated public static MboxStorageReader createReader(String fileName, boolean leaveOpen)
Creates the instance of reader.
fileName - leaveOpen - ArgumentNullExceptionpublic static MboxStorageReader createReader(String fileName, MboxLoadOptions options)
Creates the instance of reader.
fileName - options - additional options when loading a Mbox storageMboxLoadOptions.ArgumentNullExceptionpublic final IGenericEnumerable<MailMessage> enumerateMessages()
Exposes the enumerator, which supports an iteration of messages in storage.
System.Collections.Generic.IEnumerableltTgt,
that represents an enumerator that iterates through a messages in storage.public final IGenericEnumerable<MboxMessageInfo> enumerateMessageInfo()
Exposes the enumerator, which supports an iteration of messages in storage.
System.Collections.Generic.IEnumerableltTgt,
that represents an enumerator that iterates through a messages in storage.public final MailMessage extractMessage(String id, EmlLoadOptions options)
Get the message from MBOX.
id - String representation of EntryId.options - Specifies EmlLoadOptions when reading message from Mbox storage.MailMessage object.public final IGenericEnumerable<MailMessage> enumerateMessages(EmlLoadOptions options)
Exposes the enumerator, which supports an iteration of messages in storage.
options - Specifies EmlLoadOptions when reading message from Mbox storage.System.Collections.Generic.IEnumerableltTgt,
that represents an enumerator that iterates through a messages in storage.public abstract MailMessage readNextMessage()
Reads the next message from underlying storage stream.
MailMessage object if it can be read or <b>null</b> if no more messages are available.public abstract MailMessage readNextMessage(String[] fromMarker)
Reads the next message from underlying storage stream.
fromMarker - Gets the From Marker while parsing the MBox Storage file.MailMessage object if it can be read or <b>null</b> if no more messages are available.public abstract MailMessage readNextMessage(EmlLoadOptions options)
Reads the next message from underlying storage stream.
options - Specifies EmlLoadOptions when reading message from Mbox storage.MailMessage object if it can be read or <b>null</b> if no more messages are available.public abstract MailMessage readNextMessage(String[] fromMarker, EmlLoadOptions options)
Reads the next message from underlying storage stream.
fromMarker - Gets the From Marker while parsing the MBox Storage file.options - Specifies EmlLoadOptions when reading message from Mbox storage.MailMessage object if it can be read or <b>null</b> if no more messages are available.public abstract MboxMessageInfo nextMessage()
Gets the next message info.
MboxMessageInfo object if it can be read or <b>null</b> if no more messages are available.public abstract int getTotalItemsCount()
Returns the number of messages in a storage.
public final void dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
dispose in interface IDisposablepublic void close()
close in interface Closeableclose in interface AutoCloseableprotected void dispose(boolean disposing)
Releases unmanaged and - optionally - managed resources
disposing - true to release both managed and unmanaged resources; false to release only unmanaged resources.protected static boolean byteArrayStartsFromMarker(byte[] array,
byte[] marker)
Checks whether the array starts from given marker.
array - The array, can be null.marker - The marker, can't be null.protected static boolean containsAsctime(byte[] currentLine)
Determines whether the specified line contains asctime string.
currentLine - The current line.true if the specified current line contains asctime; otherwise, false.protected static byte[] readLine(Stream stream)
Reads the line from stream.
stream - The stream.Copyright (c) 2008-2023 Aspose Pty Ltd. All Rights Reserved.