org.apache.s4.comm.topology
Class ZNRecordSerializer
java.lang.Object
org.apache.s4.comm.topology.ZNRecordSerializer
- All Implemented Interfaces:
- org.I0Itec.zkclient.serialize.ZkSerializer
public class ZNRecordSerializer
- extends java.lang.Object
- implements org.I0Itec.zkclient.serialize.ZkSerializer
Utility to serialize/deserialize data in ZK.
Using Json format and Gson library.
TODO: Explore other libraries like jackson much richer features.
Gson needs no-arg constructor to work with without additional work
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ZNRecordSerializer
public ZNRecordSerializer()
serialize
public byte[] serialize(java.lang.Object data)
throws org.I0Itec.zkclient.exception.ZkMarshallingError
- Specified by:
serialize
in interface org.I0Itec.zkclient.serialize.ZkSerializer
- Throws:
org.I0Itec.zkclient.exception.ZkMarshallingError
deserialize
public java.lang.Object deserialize(byte[] bytes)
throws org.I0Itec.zkclient.exception.ZkMarshallingError
- Specified by:
deserialize
in interface org.I0Itec.zkclient.serialize.ZkSerializer
- Throws:
org.I0Itec.zkclient.exception.ZkMarshallingError