io.tarantool.driver.codecs.MessagePackFrameDecoder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cartridge-driver Show documentation
Show all versions of cartridge-driver Show documentation
Tarantool Cartridge driver for Tarantool versions 1.10+ based on Netty framework
package io.tarantool.driver.codecs;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufInputStream;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ReplayingDecoder;
import io.tarantool.driver.protocol.TarantoolResponse;
import org.msgpack.core.MessagePack;
import org.msgpack.core.MessageUnpacker;
import java.util.List;
/**
* Converts Tarantool server responses from MessagePack frames to Java objects
*
* @author Alexey Kuzin
*/
public class MessagePackFrameDecoder extends ReplayingDecoder {
private static final int MINIMAL_HEADER_SIZE = 5; // MP_UINT32
private int size;
public MessagePackFrameDecoder() {
super(DecoderState.LENGTH);
}
@Override
protected void decode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, List