java - How to read data like those stored in the *.epf file -
i want read data .epf
file, , data like:
/instance/org.eclipse.wb.core/design.palette.flyout.width=192
i think can use map<string, string>
store it, problem how rid of =
, , put left part , right part map
?
as jarnbjo mentioned, if conforms property file format, can read file using properties class.
if want store data in map, can use string function 2 parts of data:
// assuming data contains "/instance/org.eclipse.wb.core/design.palette.flyout.width=192" string[] parts = data.split("="); // parts string key = parts[0]; // /instance/org.eclipse.wb.core/design.palette.flyout.width string value = parts[1]; // 192 // or directly use map map.put(parts[0], parts[1]);
to test beforehand if string contains an, use string#contains().
if (string.contains("=")) { // split it. } else { throw new illegalargumentexception("string " + string + " not contain ="); }
Comments
Post a Comment