parsing Pipe Ini with Java -
i have ini file has data separated pipe. want read in file , set key,value string or java.
i using ini4j everywhere in order parse ini file need have sections file not have data looks
4800-722|4800 logics 4800-723|4800 logics 4800-743|4900 logics 4900-745|4900 logics 4900-746|4900 logics 4900-786|4900 logics 4800-c41|4900 controllers 4800-c42|4900 controllers
i want take , example put first 1 key second value hashmap. problem having cant find how parse ini file see should use sections , sections. cant move text file file lives on server , have use it. appreciated have far
wini ini; try { ini = new wini(new file("c:/toolbox/settings.ini")); } catch (invalidfileformatexception e) { system.out.println("invalid file format."); } catch (ioexception e) { system.out.println("problem reading file."); }
i read text file , able parse out needed code below thank unholysheep.
public static void loadetldata(string[] args) throws ioexception { string file_name = "c:/toolbox/troux_etl.ini"; arraylist<string> records = new arraylist<string>(); try { bufferedreader reader = new bufferedreader(new filereader(file_name)); string line; while ((line = reader.readline()) != null){ records.add(line); } reader.close(); system.out.println(records); } catch (filenotfoundexception e) { // todo auto-generated catch block e.printstacktrace(); } }
Comments
Post a Comment