String noURLBody;
String sourceCode;
boolean hasAttachement;
- //String encoding; //rich text, plain, html
+ String encoding; //rich text, plain, html
String messageID; // cached message ID for reuse (takes a lot of memory and is used all over the place)
//same as hashcode of a class
while((line = fileinput.readLine()) != null)
{
- String[] splittedLine = line.split();
- if(splittedLine[0].equals("Header:")) // message id
+ Vector splittedLine = line.split();
+ if(((String)(splittedLine.elementAt(0))).equals("Header:")) // message id
{
- header = splittedLine[1];
+ header = (String)splittedLine.elementAt(1);
}
- else if(splittedLine[0].equals("To:")) // receiver
+ else if(((String)(splittedLine.elementAt(0))).equals("To:")) // receiver
{
- to = splittedLine[1];
+ to = (String)splittedLine.elementAt(1);
}
- else if(splittedLine[0].equals("From:")) // sender
+ else if(((String)(splittedLine.elementAt(0))).equals("From:")) // sender
{
- from = splittedLine[1];
+ from = (String)splittedLine.elementAt(1);
}
- else if(splittedLine[0].equals("Cc:")) // cc
+ else if(((String)(splittedLine.elementAt(0))).equals("Cc:")) // cc
{
- cc = splittedLine[1];
+ cc = (String)splittedLine.elementAt(1);
}
- else if(splittedLine[0].equals("Title:")) // Subject
+ else if(((String)(splittedLine.elementAt(0))).equals("Title:")) // Subject
{
- subject = splittedLine[1];
+ subject = (String)splittedLine.elementAt(1);
break;
}
} // parsed messageID, To, from, cc, Title
return header;
}
- /*
+
public void setSentOn(String sentOn) {
this.sentOn = sentOn;
}
String receivedOn = getReceivedOn();
return parseDate(receivedOn);
}
- */
+
/**
* Parses a given Date-String in into a real Date-Object
return false;
}
*/
-
- public Vector createMailStringsWithURL()
+
+ public Vector getCommonPart()
{
Vector returnStrings = new Vector();
returnStrings.addElement(from);
returnStrings.addElement(subject);
- String[] splittedBody = body.split();
+ return returnStrings;
+ }
+
+ public String getBodyString()
+ {
+ return body;
+ }
+
+
+ public Vector getURLs()
+ {
+ Vector returnStrings = new Vector();
+ Vector splittedBody = body.split();
// add URL and email in the body
- for(int i=0; i<splittedBody.length; i++)
- //for(String segment : splittedBody)
+ for(int i=0; i<splittedBody.size(); i++)
{
- String segment = splittedBody[i];
+ String segment = (String)splittedBody.elementAt(i);
if(segment.startsWith("http://")) // URL
{
returnStrings.addElement(segment);
for(int i=0; i< splittedBody.size();i ++)
{
- String segment = splittedBody.elementAt(i);
+ String segment = (String)splittedBody.elementAt(i);
if(!(segment.startsWith("http://") || isEmailAccount(segment)))
noURLBody += segment;
// setNoURLBody method has to be called before this method
// parameter : bytesize to split.
- public Vector createMailStringsWithoutURL(int size)
+ public Vector getSplittedBody(int size)
{
setNoURLBody();
Vector returnStrings = new Vector();
- // add header, sender, and title
- returnStrings.addElement(header);
- returnStrings.addElement(from);
- returnStrings.addElement(subject);
-
char[] charArray = noURLBody.toCharArray();
String tmpStr = new String();