KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SnowMailClient > view > traceView > TraceItem


1 package SnowMailClient.view.traceView;
2
3 public class TraceItem
4 {
5   String JavaDoc content;
6   String JavaDoc from = "";
7   String JavaDoc by = "";
8   String JavaDoc For = "";
9   String JavaDoc date = "";
10
11   public TraceItem(String JavaDoc content)
12   {
13      this.content = content;
14
15      String JavaDoc contUP = content.toUpperCase();
16
17      int posFrom = contUP.indexOf("FROM");
18      if(posFrom!=-1)
19      {
20        from = content.substring(posFrom+4);
21        int posEnd = from.indexOf("\n");
22        if(posEnd!=-1) from = from.substring(0,posEnd);
23      }
24
25      int posBy = contUP.indexOf("BY");
26      if(posBy!=-1)
27      {
28        by = content.substring(posBy+2);
29        int posEnd = by.indexOf("\n");
30        if(posEnd!=-1) by = by.substring(0,posEnd);
31      }
32
33      int posFor = contUP.indexOf("FOR");
34      if(posFor!=-1)
35      {
36        For = content.substring(posFor+3);
37        int posEnd = For.indexOf(";");
38        if(posEnd!=-1)
39        {
40          For = For.substring(0,posEnd);
41        }
42      }
43
44      int posDate = content.indexOf(";");
45      if(posDate!=-1)
46      {
47        date = content.substring(posDate+1).trim();
48      }
49
50   } // Constructor
51

52   public String JavaDoc getContent() { return content; }
53   public String JavaDoc getFrom() { return from; }
54   public String JavaDoc getBy() { return by; }
55   public String JavaDoc getFor() { return For; }
56   public String JavaDoc getDate() { return date; }
57
58
59
60
61 } // TraceItem
Popular Tags