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| Modifier and Type | Field and Description |
|---|---|
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 |
| Constructor and Description |
|---|
ThriftCodec() |
| Modifier and Type | Method and Description |
|---|---|
Object |
decode(Channel channel,
ChannelBuffer buffer) |
void |
encode(Channel channel,
ChannelBuffer buffer,
Object message) |
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 String NAME
public static final String PARAMETER_CLASS_NAME_GENERATOR
public static final byte VERSION
public static final short MAGIC
public void encode(Channel channel, ChannelBuffer buffer, Object message) throws IOException
encode in interface Codec2IOExceptionpublic Object decode(Channel channel, ChannelBuffer buffer) throws IOException
decode in interface Codec2IOExceptionCopyright © 2011–2018 The Apache Software Foundation. All rights reserved.