Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- XCharStream stream = new XCharStream();
- String[] s = file.split("\n");
- List<String> section;
- List<String> str;
- String ch = "";
- String name = "";
- String value = "";
- String lastSection = "";
- Boolean writeSection = false;
- for(int i = 0; i < s.length;) {
- stream = new XCharStream(s[i].replace(" ", ""));
- Instance.sendMsg(stream.getString());
- section = new ArrayList<String>();
- str = new ArrayList<String>();
- name = "";
- value = "";
- writeSection = false;
- while(true) {
- ch = stream.next();
- if(ch == "-1") {
- if(writeSection == false) {
- if(value == "") {
- File.put(name, new ArrayList<String>());
- lastSection = name;
- } else {
- section.add(value);
- File.put(name, section);
- }
- } else {
- value = str.toString();
- File.get(lastSection).add(value);
- }
- }
- if(ch == ":") {
- if((stream.getSize() - stream.getPosition()) < stream.getSize()) {
- name = str.toString();
- }
- }
- if(ch == "-" && stream.getPosition() == 0) writeSection = true;
- str.add(ch);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment