|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.knowgate.hipermail.MboxFile
public class MboxFile
Provides access to an mbox-formatted file.
| Field Summary | |
|---|---|
static java.lang.String |
READ_ONLY
|
static java.lang.String |
READ_WRITE
|
| Constructor Summary | |
|---|---|
MboxFile(java.io.File file)
Constructor. |
|
MboxFile(java.io.File file,
java.lang.String mode)
Constructor. |
|
MboxFile(java.lang.String filepath)
Constructor. |
|
MboxFile(java.lang.String filepath,
java.lang.String mode)
Constructor. |
|
| Method Summary | |
|---|---|
long |
appendMessage(java.lang.CharSequence message)
Appends the specified message (represented by a CharSequence) to the mbox file. |
long |
appendMessage(MboxFile source,
int index)
Appends the specified message from another mbox file |
long |
appendMessage(MboxFile source,
long srcpos,
int srcsize)
Appends the specified message from another mbox file |
void |
close()
Close the mbox file and release any system resources. |
java.lang.CharSequence |
getMessage(int index)
Returns a CharSequence containing the data for the message at the specified index. |
java.io.InputStream |
getMessageAsStream(int index)
Opens an input stream to the specified message data. |
java.io.InputStream |
getMessageAsStream(long begin,
int size)
Get message as stream |
int |
getMessageCount()
Returns the total number of messages in the mbox file. |
long |
getMessagePosition(int index)
Get byte offset position of a given message inside the mbox file This method is slow when called for the first time, as it has to parse the whole Mbox file for finding each message index. |
long[] |
getMessagePositions()
Returns an initialised array of file positions for all messages in the mbox file. |
int |
getMessageSize(int index)
Get size of a message in bytes |
java.io.InputStream |
getPartAsStream(long begin,
long offset,
int size)
|
void |
purge(int[] messageNumbers)
Purge the specified messages from the file. |
long |
size()
Return MBox file size in bytes |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String READ_ONLY
public static final java.lang.String READ_WRITE
| Constructor Detail |
|---|
public MboxFile(java.io.File file)
throws java.io.FileNotFoundException,
java.io.IOException
java.io.FileNotFoundException
java.io.IOException
public MboxFile(java.io.File file,
java.lang.String mode)
throws java.io.FileNotFoundException,
java.io.IOException
file - mode - Either MboxFile.READ_ONLY or MboxFile.READ_WRITE
java.io.FileNotFoundException
java.io.IOExceptionpublic MboxFile(java.lang.String filepath)
filepath - mode - Either MboxFile.READ_ONLY or MboxFile.READ_WRITE
public MboxFile(java.lang.String filepath,
java.lang.String mode)
throws java.io.FileNotFoundException,
java.io.IOException
filepath - mode - Either MboxFile.READ_ONLY or MboxFile.READ_WRITE
java.io.FileNotFoundException
java.io.IOException| Method Detail |
|---|
public long size()
throws java.io.IOException
java.io.IOException
public long[] getMessagePositions()
throws java.io.IOException
java.io.IOException - thrown when unable to read
from the specified file channel
public long getMessagePosition(int index)
throws java.io.IOException,
java.lang.ArrayIndexOutOfBoundsException
Get byte offset position of a given message inside the mbox file
This method is slow when called for the first time, as it has to parse the whole Mbox file for finding each message index.
index - Message Index
java.io.IOException
java.lang.ArrayIndexOutOfBoundsException
public int getMessageSize(int index)
throws java.io.IOException,
java.lang.ArrayIndexOutOfBoundsException
index - Message Index
java.io.IOException
java.lang.ArrayIndexOutOfBoundsException
public int getMessageCount()
throws java.io.IOException
java.io.IOException
public java.lang.CharSequence getMessage(int index)
throws java.io.IOException
index - the index of the message to retrieve
java.io.IOException
public java.io.InputStream getMessageAsStream(long begin,
int size)
throws java.io.IOException
begin - long Byte offset position for messagesize - int Number of bytes to be readed
java.io.IOException
public java.io.InputStream getPartAsStream(long begin,
long offset,
int size)
throws java.io.IOException
java.io.IOException
public java.io.InputStream getMessageAsStream(int index)
throws java.io.IOException
index - the index of the message to open
a stream to
java.io.IOException
public final long appendMessage(MboxFile source,
long srcpos,
int srcsize)
throws java.io.IOException
source - Source mbox filesrcpos - Byte offset position of message at source mbox filesrcsize - Size of source message in bytes
java.io.IOException
public final long appendMessage(MboxFile source,
int index)
throws java.io.IOException
source - Source mbox fileindex - Index of message to be appended at the source file
java.io.IOException
public final long appendMessage(java.lang.CharSequence message)
throws java.io.IOException
message -
java.io.IOException
public void purge(int[] messageNumbers)
throws java.io.IOException,
java.lang.IllegalArgumentException
messageNumbers - int[]
java.io.IOException
java.lang.IllegalArgumentException
public void close()
throws java.io.IOException
java.io.IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||