public class MailMsg extends Document implements AsciiComm
NOT_CONNECTED, NOT_READY, OUT_OF_RANGE
Constructor and Description |
---|
MailMsg()
Constructs an empty MailMsg.
|
MailMsg(java.lang.String message,
FileName file)
Constructs a MailMsg from an input mail message, complete with header and MIME attachments, and the name of the
file from which it was createTool.
|
Modifier and Type | Method and Description |
---|---|
StringVector |
addressList(java.lang.String addresses)
Attempts to separate the input String into addresses of email recipients.
|
void |
addToFolder(java.lang.String fn)
Adds to the list toFolders a foldername (just a String ) of the folder (mailbox) into which the message
should be written.
|
void |
addToFolders(StringVector fns)
Adds to the list toFolders a StringVector of foldernames of the folders (mailboxes) into which the message
should be written.
|
boolean |
checkMIME()
Checks MIME attachments to see if the delimiters are consistent.
|
TrianaType |
copyMe()
This is one of the most important methods of Triana data.
|
void |
copyParameters(TrianaType source)
Copies modifiable parameters from the given source.
|
StringVector |
copyToFolders()
Returns a copy-by-value of the list of filenames of the folders (mailboxes) into which the message should be
written.
|
boolean |
equals(java.lang.Object doc)
Returns true if the specified object doc is the same type and has the same contents as this object,
including the path name and file name.
|
static java.lang.String |
filenameFromName(java.lang.String nameIn)
Creates a filename in a standard format from an input personal name.
|
java.lang.String |
getBlindCopiesTo()
Returns the blind (hidden) carbon-copy recipient(s) of the message as a String containing all such recipients,
exactly as in the email message.
|
StringVector |
getBlindCopiesToList()
Returns the blind (hidden) recipient addressess in a StringVector, one recipient per element.
|
java.lang.String |
getBody()
Returns the message body, without the header, including any MIME attachments.
|
int |
getBodyLocation()
Returns the character index location where the message body begins after the header.
|
java.lang.String |
getBodyNoMIME()
Returns the message body, without the header or MIME attachments.
|
java.lang.String |
getCopiesTo()
Returns the carbon-copy recipient(s) of the message as a String containing all such recipients just as contained
in the email message.
|
StringVector |
getCopiesToList()
Returns the carbon-copy recipient addressess in a StringVector, one recipient per element.
|
java.lang.String |
getDate()
Returns the date of the message.
|
boolean |
getDeletion()
Returns true if the message has been marked for deletion.
|
FileName |
getFromFolder()
Returns the filename of the folder (mailbox) from which the message was createTool.
|
java.lang.String |
getID()
Returns the ID of the message.
|
boolean |
getLock()
Returns the value of the lock parameter
|
FileName |
getMailRoot()
Returns the filename of the directory that is the root of the mail file system from which this message came.
|
java.lang.String |
getMIME()
Returns the MIME attachment, as encoded in the message.
|
int |
getMIMELocation()
Returns the character index location where the MIME attachment begins after the main body text.
|
java.lang.String |
getRecipient()
Returns the recipient(s) of the message as a String containing all recipients, just as given in the email
message.
|
StringVector |
getRecipientList()
Returns the recipient addresses in a StringVector, one recipient per element.
|
java.lang.String |
getSender()
Returns the sender of the message.
|
StringVector |
getSenderList()
Returns the sender of the message as a StringVector with one element.
|
java.lang.String |
getSubject()
Returns the subject of the message.
|
StringVector |
getToFolders()
Returns the list of filenames of the folders (mailboxes) into which the message should be written.
|
void |
inputFromStream(java.io.BufferedReader dis)
Used when Triana types want to be able to receive ASCII data from the output of other programs.
|
boolean |
isDamaged()
Returns true if the message has been marked as damaged.
|
void |
lock()
Locks the message so it cannot be edited.
|
void |
outputToStream(java.io.PrintWriter dos)
Used when Triana types want to be able to send ASCII data to other programs using strings.
|
static StringVector |
parseAddress(java.lang.String fullAddress)
Parses a String containing a single recipient address into the email address (the part containing the @ symbol)
and the name of the person, if it exists.
|
java.util.Date |
parseDate(java.text.SimpleDateFormat s) |
void |
setBlindCopiesTo(java.lang.String newBlindCopiesTo)
Sets the blind (hidden) carbon-copy recipient(s) of the message.
|
void |
setBodyLocation(int newBody)
Sets the character index at which the message starts, after the header.
|
void |
setCopiesTo(java.lang.String newCopiesTo)
Sets the carbon-copy recipient(s) of the message.
|
void |
setDamaged(boolean dam)
Sets the boolean flag that marks the message as damaged.
|
void |
setDate(java.lang.String newDate)
Sets the date of the message.
|
void |
setDeletion(boolean del)
Sets the boolean flag that deletes the message.
|
void |
setFromFolder(FileName fn)
Sets the filename of the folder (mailbox) from which the message was createTool.
|
void |
setID(java.lang.String newID)
Sets the ID of the message.
|
boolean |
setMailRoot(FileName fn)
Sets the filename of the directory that is the root of the mail file system from which this message came.
|
void |
setMIMELocation(int newMIME)
Sets the character index at which the MIME attachment starts, after the body text.
|
void |
setRecipient(java.lang.String newRecipient)
Sets the recipient(s) of the message.
|
void |
setSender(java.lang.String newSender)
Sets the sender of the message.
|
void |
setSubject(java.lang.String newSubject)
Sets the subject of the message.
|
void |
setToFolders(StringVector to)
Sets the list of filenames of the folders (mailboxes) into which the message should be written.
|
java.lang.String |
toString()
Provides the toString method for completeness.
|
void |
unlock()
Unlocks the message so it can be edited.
|
add, addCharGroupsLayer, addLine, addLineNumber, containedInCharGroup, containedInCharGroup, copyData, countLines, cutGroupString, cutString, deleteCharGroups, deleteLineNumber, deleteLineNumbers, domainOfCharGroup, existCharGroups, findNext, findNext, findNextInGroup, findNextInGroup, getCharGroup, getCharGroups, getCharGroups, getCharGroupsComplement, getCharGroupStack, getDomain, getFile, getFileNoPath, getFileRef, getFileType, getGroupString, getLineNumber, getLineNumbers, getPath, getString, getText, insertString, insertStringAsCharGroup, isLineNumber, isTextHTML, length, listCharGroups, listCharGroups, listGroupStrings, listGroupStrings, listGroupStringsNoDelims, listLineNumbers, listLineNumbersAndLines, nextCharGroup, nextCharGroup, nextLineNo, prevCharGroup, prevCharGroup, remove, remove, removeCharGroup, removeCharGroups, replaceAll, replaceGroupString, replaceNext, replaceNext, replaceString, setCharGroup, setCharGroups, setFile, setFile, setLineNumbers, setText, shiftCharGroups, shiftLineNumbers, updateObsoletePointers
containerSize, dataExists, deleteFromContainer, getDataContainer, getFromContainer, getSequenceNumber, insertIntoContainer, inspectDataContainer, setDataContainer, setSequenceNumber
public MailMsg()
public MailMsg(java.lang.String message, FileName file)
message
- The email message, with its headerpublic java.util.Date parseDate(java.text.SimpleDateFormat s)
public java.lang.String getSender()
public StringVector getSenderList()
public void setSender(java.lang.String newSender)
newSender
- The sender to be set into the messagepublic java.lang.String getDate()
public void setDate(java.lang.String newDate)
newDate
- The date to be set into the messagepublic java.lang.String getRecipient()
public StringVector getRecipientList()
public void setRecipient(java.lang.String newRecipient)
newRecipient
- The recipient(s) to be set into the messagepublic java.lang.String getCopiesTo()
public StringVector getCopiesToList()
public void setCopiesTo(java.lang.String newCopiesTo)
newCopiesTo
- The carbon-copy recipient(s) to be set into the messagepublic java.lang.String getBlindCopiesTo()
public StringVector getBlindCopiesToList()
public void setBlindCopiesTo(java.lang.String newBlindCopiesTo)
newBlindCopiesTo
- The blind carbon-copy recipient(s) to be set into the messagepublic StringVector addressList(java.lang.String addresses)
addresses
- The input newline- and comma-separated list of addressespublic java.lang.String getSubject()
public void setSubject(java.lang.String newSubject)
newSubject
- The subject to be set into the messagepublic java.lang.String getID()
public void setID(java.lang.String newID)
newID
- The ID to be set into the messagepublic boolean setMailRoot(FileName fn)
fn
- The FileName of the directory that is the mail system rootpublic FileName getMailRoot()
public void setFromFolder(FileName fn)
fn
- The file which contained the message when it was createdpublic FileName getFromFolder()
public void setToFolders(StringVector to)
to
- The file into which the message should be writtenpublic void addToFolder(java.lang.String fn)
fn
- The file into which the message should be writtenpublic void addToFolders(StringVector fns)
fns
- The file into which the message should be writtenpublic StringVector getToFolders()
public StringVector copyToFolders()
public boolean getDeletion()
public void setDeletion(boolean del)
del
- True if the message is to be deletedpublic boolean isDamaged()
public void setDamaged(boolean dam)
dam
- True if the message is damagedpublic int getBodyLocation()
public void setBodyLocation(int newBody)
newBody
- The starting character of the message bodypublic int getMIMELocation()
public void setMIMELocation(int newMIME)
newMIME
- The starting character of the MIME attachmentpublic boolean getLock()
public void unlock()
public void lock()
public java.lang.String getBody()
public java.lang.String getBodyNoMIME()
public java.lang.String getMIME()
public boolean checkMIME()
public static StringVector parseAddress(java.lang.String fullAddress)
The method finds the email address by looking for the first
fullAddress
- The input String containing the full addresspublic static java.lang.String filenameFromName(java.lang.String nameIn)
nameIn
- Input personal namepublic boolean equals(java.lang.Object doc)
public TrianaType copyMe()
To override, the programmer should not invoke the super.copyMe method. Instead, create an object of the current type and call methods copyData and copyParameters. If these have been written correctly, then they will do the copying. The code should createTool, for type YourType:
YourType y = null; try { y = (YourType)getClass().newInstance(); y.copyData( this ); y.copyParameters( this ); y.setLegend( this.getLegend() ); } catch (IllegalAccessException ee) { System.out.println("Illegal Access: " + ee.getMessage()); } catch (InstantiationException ee) { System.out.println("Couldn't be instantiated: " + ee.getMessage()); } return y;
The copied object's data should be identical to the original. The method here modifies only one item: a String indicating that the object was created as a copy is added to the description StringVector.
public void copyParameters(TrianaType source)
copyParameters
in class Document
source
- The Document object being copiedpublic void outputToStream(java.io.PrintWriter dos) throws java.io.IOException
This method must be overridden in every subclass that defines new data or parameters. The overriding method should first call
super.outputToStream(dos)to get output from superior classes, and then new parameters defined for the current subclass must be output. Moreover, subclasses that first dimension their data arrays must explicitly transfer these data arrays.
outputToStream
in interface AsciiComm
outputToStream
in class Document
dos
- The data output streamjava.io.IOException
public void inputFromStream(java.io.BufferedReader dis) throws java.io.IOException
This method must be overridden in every subclass that defines new data or parameters. The overriding method should first call
super.inputFromStream(dis)to get input from superior classes, and then new parameters defined for the current subclass must be input. Moreover, subclasses that first dimension their data arrays must explicitly transfer these data arrays.
inputFromStream
in interface AsciiComm
inputFromStream
in class Document
dis
- The data input streamjava.io.IOException