com.alibaba.dubbo.rpc.protocol.thrift
Class ThriftCodec
java.lang.Object
com.alibaba.dubbo.rpc.protocol.thrift.ThriftCodec
- All Implemented Interfaces:
- Codec
public class ThriftCodec
- extends Object
- implements Codec
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,
OutputStream output,
Object message)
throws IOException
- Description copied from interface:
Codec
- Encode message.
- Specified by:
encode in interface Codec
- Parameters:
channel - channel.output - output stream.message - message.
- Throws:
IOException
decode
public Object decode(Channel channel,
InputStream input)
throws IOException
- Description copied from interface:
Codec
- Decode message.
- Specified by:
decode in interface Codec
- Parameters:
channel - channel.input - input stream.
- Returns:
- message or
NEED_MORE_INPUT poison.
- Throws:
IOException- See Also:
Codec.NEED_MORE_INPUT
Copyright © 2012 Alibaba. All Rights Reserved.