io.servicefabric.transport.ProtostuffMessageDeserializer Maven / Gradle / Ivy
The newest version!
package io.servicefabric.transport;
import static io.protostuff.ProtostuffIOUtil.mergeFrom;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufInputStream;
import io.netty.handler.codec.DecoderException;
import io.protostuff.Schema;
import io.protostuff.runtime.RuntimeSchema;
final class ProtostuffMessageDeserializer implements MessageDeserializer {
@Override
public Message deserialize(ByteBuf bb) {
// Deserialize BinaryMessage
Schema schema = RuntimeSchema.getSchema(Message.class);
Message message = schema.newMessage();
try {
mergeFrom(new ByteBufInputStream(bb), message, schema);
} catch (Exception e) {
throw new DecoderException(e.getMessage(), e);
}
return message;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy