|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.fortuna.mstor.data.MboxFile
public class MboxFile
Provides access to an mbox-formatted file. To read an mbox file using a non-standard file encoding you may specify the following system property:
-Dmstor.mbox.encoding=<some_encoding>If no encoding system property is specified the default file encoding will be used.
Field Summary | |
---|---|
static String |
FROM__PREFIX
The prefix for all "From_" lines in an mbox file. |
static String |
READ_ONLY
|
static String |
READ_WRITE
|
Constructor Summary | |
---|---|
MboxFile(File file)
Constructor. |
|
MboxFile(File file,
String mode)
Constructor. |
Method Summary | |
---|---|
void |
appendMessage(byte[] message)
Appends the specified message (represented by a CharSequence) to the mbox file. |
void |
close()
Close the mbox file and release any system resources. |
byte[] |
getMessage(int index)
Convenience method that returns a message as a byte array containing the data for the message at the specified index. |
InputStream |
getMessageAsStream(int index)
Opens an input stream to the specified message data. |
int |
getMessageCount()
Returns the total number of messages in the mbox file. |
static boolean |
isValid(File file)
Indicates whether the specified file appears to be a valid mbox file. |
void |
purge(int[] msgnums)
Purge the specified messages from the file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String READ_ONLY
public static final String READ_WRITE
public static final String FROM__PREFIX
Constructor Detail |
---|
public MboxFile(File file) throws FileNotFoundException
FileNotFoundException
public MboxFile(File file, String mode)
Method Detail |
---|
public final int getMessageCount() throws IOException
IOException
public final InputStream getMessageAsStream(int index) throws IOException
index
- the index of the message to open a stream to
IOException
public final byte[] getMessage(int index) throws IOException
index
- the index of the message to retrieve
IOException
public final void appendMessage(byte[] message) throws IOException
message
-
IOException
public final void purge(int[] msgnums) throws IOException
msgnums
- the indices of the messages to purge
IOException
public final void close() throws IOException
IOException
public static boolean isValid(File file)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |