MCPcopy Create free account
hub / github.com/BombusMod/BombusMod / importData

Method importData

src/main/java/History/HistoryStorage.java:64–94  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

62 }
63
64 public Vector importData() {
65 Vector vector=new Vector();
66 if (history!=null) {
67 try {
68 int pos=0; int start_pos=0; int end_pos=0;
69 String type=null; String date=null; String from=null; String subj=null; String body=null; String tempstr=null;
70
71 while (true) {
72 type=null; date=null; from=null; subj=null; body=null; tempstr=null;
73 start_pos=history.indexOf("<m>",pos); end_pos=history.indexOf("</m>",start_pos);
74
75 if (start_pos>-1) {
76 tempstr=history.substring(start_pos+3, end_pos);
77 type=findBlock(tempstr,"t"); date=findBlock(tempstr,"d"); from=findBlock(tempstr,"f"); subj=findBlock(tempstr,"s"); body=findBlock(tempstr,"b");
78
79 if (Integer.parseInt(type)!=MESSAGE_MARKER_PRESENCE) {
80 //System.out.println(type+" ["+date+"]"+from+": "+subj+" "+body+"\r\n");
81 vector.insertElementAt(HistoryLoader.processMessage(type, date, from, subj, body), 0);
82 }
83 } else
84 break;
85 pos=end_pos+4;
86 }
87 if(vector.size()>5)
88 vector.setSize(5);
89 } catch (Exception e) { }
90 }
91
92 history = null;
93 return vector;
94 }
95
96 private String findBlock(String source, String needle){
97 String block = "";

Callers 1

loadRecentListMethod · 0.95

Calls 4

findBlockMethod · 0.95
processMessageMethod · 0.95
sizeMethod · 0.45
setSizeMethod · 0.45

Tested by

no test coverage detected