Below are Tools which support YAML for JAVA API’s. Here I will focus only on SnakeYAML which widely used by industry.
- JvYaml
- SnakeYAML
- YamlBeans
- JYaml
- Camel
SnakeYAML Configuration
JAVA
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.20-SNAPSHOT</version>
</dependency>
Android
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.20-SNAPSHOT</version>
<classifier>android</classifier>
</dependency>
For any operation with SnakeYAML api’s you have to use below steps:
package :
org.yaml.snakeyaml.Yaml
Intialization:
Yaml yaml = new Yaml();
Loading YAML :
- yaml.load(String) accepts a String.
- yaml.load(InputStream) accepts a InputStream.
yaml.load(InputStream) detects the encoding by checking the BOM (byte order mark) sequence at the beginning of streams. If no BOM presents the utf-8 encoding is assumed..
More
To know more about YAML Syntax, Configuration with Java and other supporting language, frameworks and tools, Sample configuration files and JSON and YAML conversion follow below YAML Tutorials and YAML related exceptions follow YAML Issues.
You must log in to post a comment.