- public static void main(String[] args) throws IOException {
-
-
- Map config = new Yaml().loadAs(new FileInputStream("C:\\Users\\z00292420\\Desktop\\juju\\config2.yaml"), Map.class);
- Map options = (Map)config.get("options");
- Map name = (Map)options.get("name");
- name.put("default","hello,it's me");
-// new Yaml().dump(config, new FileWriter("C:\\Users\\z00292420\\Desktop\\juju\\config2.yaml"));
- String newYaml = new Yaml().dumpAsMap(config);
- try(Writer w = new FileWriter(new File("C:\\Users\\z00292420\\Desktop\\juju"))){
- w.write(newYaml);
- }catch(Exception e){
- log.error("Write Yaml Error: ",e);
- throw new IOException("Write Yaml Error" + e);
- }
- //System.out.println(newYaml);
- }