public class JanksonSerializer extends java.lang.Object implements Serializer<blue.endless.jankson.JsonObject>
| Constructor and Description |
|---|
JanksonSerializer() |
JanksonSerializer(Marshaller<blue.endless.jankson.JsonElement> marshaller,
boolean compress) |
| Modifier and Type | Method and Description |
|---|---|
blue.endless.jankson.JsonObject |
deserialize(ConfigTree tree,
java.io.InputStream stream)
Deserializes data from an
InputStream into a config tree. |
blue.endless.jankson.JsonObject |
deserialize(ConfigTree tree,
blue.endless.jankson.JsonObject element)
Deserializes an intermediate element into a config tree.
|
static Marshaller<blue.endless.jankson.JsonElement> |
extendDefaultMarshaller(Marshaller<blue.endless.jankson.JsonElement> marshaller) |
FiberId |
getIdentifier() |
blue.endless.jankson.JsonObject |
serialize(ConfigTree tree)
Serializes a config tree.
|
void |
serialize(ConfigTree tree,
blue.endless.jankson.JsonObject additionalData,
java.io.OutputStream out)
Serializes a config tree and writes it to an
OutputStream. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitserializepublic JanksonSerializer()
public JanksonSerializer(@Nonnull
Marshaller<blue.endless.jankson.JsonElement> marshaller,
boolean compress)
public blue.endless.jankson.JsonObject deserialize(ConfigTree tree, java.io.InputStream stream) throws java.io.IOException, FiberException
SerializerInputStream into a config tree.
If the serialized tree has elements not present in the actual node, they will be collected as a separate data structure and returned.
deserialize in interface Serializer<blue.endless.jankson.JsonObject>tree - the node to deserializestream - the serialized data for the nodejava.io.IOExceptionFiberExceptionpublic blue.endless.jankson.JsonObject deserialize(ConfigTree tree, blue.endless.jankson.JsonObject element) throws FiberException
SerializerIf the serialized tree has elements not present in the actual node, they will be collected as a separate data structure and returned.
deserialize in interface Serializer<blue.endless.jankson.JsonObject>tree - the node to deserializeelement - the serialized data for the nodeFiberExceptionpublic void serialize(ConfigTree tree, @Nullable blue.endless.jankson.JsonObject additionalData, java.io.OutputStream out) throws java.io.IOException
SerializerOutputStream.
The caller may pass in additional data to be appended to the serialized tree. In case of conflict between the serialized tree and the additional data (eg. map representation with conflicting keys), the conflicting data from the serialized tree gets overwritten.
The additionalData may be used with the leftovers from
Serializer.deserialize(ConfigTree, InputStream) to inject back unrecognized nodes.
serialize in interface Serializer<blue.endless.jankson.JsonObject>tree - the node to serializeadditionalData - data to append to the serialized treeout - the stream to which the serialized data is to be writtenjava.io.IOExceptionpublic blue.endless.jankson.JsonObject serialize(ConfigTree tree)
Serializerserialize in interface Serializer<blue.endless.jankson.JsonObject>tree - the node to serializepublic FiberId getIdentifier()
getIdentifier in interface Serializer<blue.endless.jankson.JsonObject>public static Marshaller<blue.endless.jankson.JsonElement> extendDefaultMarshaller(Marshaller<blue.endless.jankson.JsonElement> marshaller)