Search in sources :

Example 1 with TypedByteArrayDeserializer

use of com.hazelcast.nio.serialization.TypedByteArrayDeserializer in project hazelcast by hazelcast.

the class ByteArraySerializerAdapter method read.

@Override
public Object read(ObjectDataInput in, Class aClass) throws IOException {
    byte[] bytes = in.readByteArray();
    if (bytes == null) {
        return null;
    }
    if (!(serializer instanceof TypedByteArrayDeserializer)) {
        throw new HazelcastSerializationException(serializer + " is not implementing the " + TypedByteArrayDeserializer.class + " interface. Please implement this interface to deserialize for class " + aClass);
    }
    TypedByteArrayDeserializer deserializer = (TypedByteArrayDeserializer) serializer;
    return deserializer.read(bytes, aClass);
}
Also used : HazelcastSerializationException(com.hazelcast.nio.serialization.HazelcastSerializationException) TypedByteArrayDeserializer(com.hazelcast.nio.serialization.TypedByteArrayDeserializer)

Aggregations

HazelcastSerializationException (com.hazelcast.nio.serialization.HazelcastSerializationException)1 TypedByteArrayDeserializer (com.hazelcast.nio.serialization.TypedByteArrayDeserializer)1