Yuta HIGUCHI | f148aac | 2014-05-05 14:59:06 -0700 | [diff] [blame] | 1 | package net.onrc.onos.core.datastore.utils; |
| 2 | |
| 3 | /** |
| 4 | * Interface to serialize object into byte[]. |
| 5 | * |
| 6 | * Serializer instance is expected to be functional even if the |
| 7 | * instance was shared among multiple threads. |
| 8 | */ |
| 9 | public interface Serializer { |
| 10 | /** |
| 11 | * Serializes a given object. |
| 12 | * |
| 13 | * @param obj the object to serialize |
| 14 | * @return binary representation of the serialized object |
| 15 | */ |
| 16 | public byte[] serialize(final Object obj); |
| 17 | |
| 18 | /** |
| 19 | * Deserializes a given byte array. |
| 20 | * |
| 21 | * @param bytes binary representation of an Object |
| 22 | * @return deserialized object |
| 23 | */ |
| 24 | public <T> T deserialize(final byte[] bytes); |
| 25 | } |