Package org.rapidcontext.core.data
Class YamlSerializer
java.lang.Object
org.rapidcontext.core.data.YamlSerializer
A data serializer and unserializer for the YAML format. The object
mapping to YAML is not exact, and may omit serialization of data
in some cases. The following basic requirements must be met in
order to serialize an object:
- No circular references are permitted.
- String, Integer, Boolean, Date, Array and Dict values are supported.
- Version:
- 1.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringSerializes an object into a YAML representation.static voidserialize(Object obj, OutputStream os) Serializes an object into a YAML representation.static Objectunserialize(String yaml) Unserializes an object from a YAML representation.
-
Method Details
-
serialize
Serializes an object into a YAML representation.- Parameters:
obj- the object to convert, or nullos- the output stream to write to- Throws:
IOException- if the data couldn't be serialized
-
serialize
Serializes an object into a YAML representation.- Parameters:
obj- the object to serialize, or null- Returns:
- a YAML file representation
-
unserialize
Unserializes an object from a YAML representation.- Parameters:
yaml- the YAML text to load- Returns:
- the object read
- Throws:
IOException- if an error occurred while reading
-