com.alibaba.dubbo.rpc.protocol.thrift
Class ThriftCodec
java.lang.Object
com.alibaba.dubbo.rpc.protocol.thrift.ThriftCodec
- All Implemented Interfaces:
- Codec2
public class ThriftCodec
- extends Object
- implements Codec2
Thrift framed protocol codec.
|<- message header ->|<- message body ->|
+----------------+----------------------+------------------+---------------------------+------------------+
| magic (2 bytes)|message size (4 bytes)|head size(2 bytes)| version (1 byte) | header | message body |
+----------------+----------------------+------------------+---------------------------+------------------+
|<- message size ->|
header fields in version 1
- string - service name
- long - dubbo request id
- Author:
- gang.lvg
MESSAGE_LENGTH_INDEX
public static final int MESSAGE_LENGTH_INDEX
- See Also:
- Constant Field Values
MESSAGE_HEADER_LENGTH_INDEX
public static final int MESSAGE_HEADER_LENGTH_INDEX
- See Also:
- Constant Field Values
MESSAGE_SHORTEST_LENGTH
public static final int MESSAGE_SHORTEST_LENGTH
- See Also:
- Constant Field Values
NAME
public static final String NAME
- See Also:
- Constant Field Values
PARAMETER_CLASS_NAME_GENERATOR
public static final String PARAMETER_CLASS_NAME_GENERATOR
- See Also:
- Constant Field Values
VERSION
public static final byte VERSION
- See Also:
- Constant Field Values
MAGIC
public static final short MAGIC
- See Also:
- Constant Field Values
ThriftCodec
public ThriftCodec()
encode
public void encode(Channel channel,
ChannelBuffer buffer,
Object message)
throws IOException
- Specified by:
encode
in interface Codec2
- Throws:
IOException
decode
public Object decode(Channel channel,
ChannelBuffer buffer)
throws IOException
- Specified by:
decode
in interface Codec2
- Throws:
IOException
Copyright © 2012–2017 Alibaba. All rights reserved.