T - a type of serializable objectpublic interface Serializer<T>
Implementations must ensure that for any object o,
toBytes(Object) produces such an array, that being passed to fromBytes(byte[]),
is converted to another object o2, that is equal to the original object o.
This interface is designed to be primarily used by storage proxies and proof validators.
StandardSerializers| Modifier and Type | Method and Description |
|---|---|
T |
fromBytes(byte[] serializedValue)
De-serializes a value from a given byte array.
|
byte[] |
toBytes(T value)
Serializes a given value into a byte array.
|
byte[] toBytes(T value)
value - a value to serialize, must not be nulljava.lang.NullPointerException - if value is nullT fromBytes(byte[] serializedValue)
serializedValue - an array containing a serialized value of type T, must not be nulljava.lang.NullPointerException - if the array is nulljava.lang.IllegalArgumentException - if the array cannot be decoded into a value of type T
(e.g., contains 2 bytes when 4 are expected)Copyright © 2018 Exonum. All rights reserved.