public class ThriftCodec extends Object implements Codec2
|<- 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
Codec2.DecodeResult| 限定符和类型 | 字段和说明 |
|---|---|
static short |
MAGIC |
static int |
MESSAGE_HEADER_LENGTH_INDEX |
static int |
MESSAGE_LENGTH_INDEX |
static int |
MESSAGE_SHORTEST_LENGTH |
static String |
NAME |
static String |
PARAMETER_CLASS_NAME_GENERATOR |
static byte |
VERSION |
| 构造器和说明 |
|---|
ThriftCodec() |
public static final int MESSAGE_LENGTH_INDEX
public static final int MESSAGE_HEADER_LENGTH_INDEX
public static final int MESSAGE_SHORTEST_LENGTH
public static final byte VERSION
public static final short MAGIC
public void encode(Channel channel, ChannelBuffer buffer, Object message) throws IOException
encode 在接口中 Codec2IOExceptionpublic Object decode(Channel channel, ChannelBuffer buffer) throws IOException
decode 在接口中 Codec2IOExceptionCopyright © 2011–2018 The Apache Software Foundation. All rights reserved.