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

Method importData

src/main/java/IE/ArchiveTemplates.java:89–122  ·  view source on GitHub ↗
(String arhPath)

Source from the content-addressed store, hash-verified

87 }
88
89 public Vector importData(String arhPath) {
90 Vector vector = new Vector();
91 FileIO f = FileIO.createConnection(arhPath);
92 String archiveData = f.fileReadUtf();
93
94 if (!archiveData.equals("")) {
95 try {
96 int pos = 0, start_pos, end_pos;
97 while (true) {
98 String date, from, subj, body, tempstr;
99 start_pos = archiveData.indexOf(start_item, pos);
100 end_pos = archiveData.indexOf(end_item, pos);
101
102 if (start_pos > -1 && end_pos > -1) {
103 tempstr = archiveData.substring(start_pos + start_item.length(), end_pos);
104 date = findBlock(tempstr, start_date, end_date);
105 from = findBlock(tempstr, start_from, end_from);
106 subj = findBlock(tempstr, start_subj, end_subj);
107 body = findBlock(tempstr, start_body, end_body);
108 //System.out.println("["+date+"]"+from+": "+subj+" "+body+"\r\n");
109 Msg msg = new Msg(Msg.MESSAGE_TYPE_IN, from, subj, body);
110 msg.setDayTime(date);
111 vector.insertElementAt(msg, 0);
112 } else {
113 break;
114 }
115 pos = end_pos + end_item.length();
116 }
117 } catch (Exception e) {
118 //System.out.println(e.toString());
119 }
120 }
121 return vector;
122 }
123
124 private String findBlock(String source, String _start, String _end){
125 String block = "";

Callers 1

importArchiveMethod · 0.95

Calls 5

createConnectionMethod · 0.95
fileReadUtfMethod · 0.95
findBlockMethod · 0.95
setDayTimeMethod · 0.95
equalsMethod · 0.45

Tested by

no test coverage detected