<dependencies> <dependency> <groupId>org.clojure</groupId> <artifactId>clj-yaml</artifactId> <version>0.6.2</version> </dependency> </dependencies> import org.yaml.snakeyaml.Yaml; Yaml yaml = new Yaml(); try (InputStream inputStream = new FileInputStream("path/to/your.yaml")) { Object obj = yaml.load(inputStream); } catch (IOException e) { e.printStackTrace(); } try (OutputStream outputStream = new FileOutputStream("path/to/your.yaml")) { yaml.dump(javaObjectToSerialize, outputStream); } catch (IOException e) { e.printStackTrace(); }


上一篇:
下一篇:
切换中文