public class Test { public Test() { } public static void main(String[] args) { Test test = new Test(); Properties props = new Properties(); StringWriter sw = new StringWriter(); sw.write("Key1 = Vlaue1 \n"); sw.write(" Key2 : Vlaue2 \r\n"); sw.write(" Key3 Vlaue3 \n "); InputStream is = new ByteArrayInputStream(sw.toString().getBytes()); try { props.load(is); } catch (IOException ex) { ex.printStackTrace(); } props.list(System.out); props.setProperty("Key1","Modified Value1"); props.setProperty("Key4","Added Value4"); props.list(System.out); } } |
Пример 14.22. |
Закрыть окно |