public class StringDeserializer<T> extends Object implements Deserializer<T>
StringSerializer
should be used as the corresponding Serializer
.
Modifier and Type | Method and Description |
---|---|
static Deserializer<String> |
create() |
static <T> Deserializer<T> |
create(Function<String,T> toObject)
Retrieves an instance of this deserializer.
|
T |
deserialize(byte[] item)
Deserializes an array of bytes back to an object.
|
public T deserialize(byte[] item)
Deserializer
Any array of bytes should lead to either a non null
value or throw an
IllegalArgumentException
.
The output must be consistent, an identical output should be returned if called twice
on the identical arrays: for any valid a1
and a2
,
Arrays.equals(a1, a2)
implies
deserialize(a1).equals(deserialize(a2))
.
deserialize
in interface Deserializer<T>
item
- the array of bytes representing an object.public static <T> Deserializer<T> create(Function<String,T> toObject)
toObject
- the function to convert items from the intermediate string to an actual object.public static Deserializer<String> create()
Copyright © 2014. All rights reserved.