// This example shows how to serialize data to YAML format.
// You can save data to the file and restore the map.
import org.yaml.snakeyaml.*;
import java.util.*;
class io_yaml_example {
public static void main(String[] args) {
Map data = new HashMap();
data.put("name", "Silenthand Olleander");
data.put("race", "Human");
data.put("traits", new String[] { "ONE_HAND", "ONE_EYE" });
Yaml yaml = new Yaml();
String output = yaml.dump(data);
System.out.println("YAML data:\n\n\n");
System.out.println(output);
}
}
Ads help maintain this website.