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 String
Serializes an object into a YAML representation.static void
serialize
(Object obj, OutputStream os) Serializes an object into a YAML representation.static Object
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:
is
- the input stream to load- Returns:
- the object read
- Throws:
IOException
- if an error occurred while reading
-