AbstractBinaryMemcacheEncoder Class — netty Architecture
Architecture documentation for the AbstractBinaryMemcacheEncoder class in AbstractBinaryMemcacheEncoder.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD c0127127_55ab_c54a_d0b6_112591318d9e["AbstractBinaryMemcacheEncoder"] f7a4f8cf_7922_cc83_d27d_6d992760dfc9["AbstractBinaryMemcacheEncoder.java"] c0127127_55ab_c54a_d0b6_112591318d9e -->|defined in| f7a4f8cf_7922_cc83_d27d_6d992760dfc9 54226423_9949_79d5_3f5e_70cdb2ba43d9["ByteBuf()"] c0127127_55ab_c54a_d0b6_112591318d9e -->|method| 54226423_9949_79d5_3f5e_70cdb2ba43d9 d3275c21_21f7_f97a_f046_8558b7365ad6["encodeExtras()"] c0127127_55ab_c54a_d0b6_112591318d9e -->|method| d3275c21_21f7_f97a_f046_8558b7365ad6 b9f7587a_05d2_9c50_bb16_1120f363e6c5["encodeKey()"] c0127127_55ab_c54a_d0b6_112591318d9e -->|method| b9f7587a_05d2_9c50_bb16_1120f363e6c5 7dbfe5bc_295a_8c11_b83d_41148732021e["encodeHeader()"] c0127127_55ab_c54a_d0b6_112591318d9e -->|method| 7dbfe5bc_295a_8c11_b83d_41148732021e
Relationship Graph
Source Code
codec-memcache/src/main/java/io/netty/handler/codec/memcache/binary/AbstractBinaryMemcacheEncoder.java lines 27–87
@UnstableApi
public abstract class AbstractBinaryMemcacheEncoder<M extends BinaryMemcacheMessage>
extends AbstractMemcacheObjectEncoder<M> {
/**
* Every binary memcache message has at least a 24 bytes header.
*/
private static final int MINIMUM_HEADER_SIZE = 24;
@Override
protected ByteBuf encodeMessage(ChannelHandlerContext ctx, M msg) {
ByteBuf buf = ctx.alloc().buffer(MINIMUM_HEADER_SIZE + msg.extrasLength()
+ msg.keyLength());
encodeHeader(buf, msg);
encodeExtras(buf, msg.extras());
encodeKey(buf, msg.key());
return buf;
}
/**
* Encode the extras.
*
* @param buf the {@link ByteBuf} to write into.
* @param extras the extras to encode.
*/
private static void encodeExtras(ByteBuf buf, ByteBuf extras) {
if (extras == null || !extras.isReadable()) {
return;
}
buf.writeBytes(extras);
}
/**
* Encode the key.
*
* @param buf the {@link ByteBuf} to write into.
* @param key the key to encode.
*/
private static void encodeKey(ByteBuf buf, ByteBuf key) {
if (key == null || !key.isReadable()) {
return;
}
buf.writeBytes(key);
}
/**
* Encode the header.
* <p/>
* This methods needs to be implemented by a sub class because the header is different
* for both requests and responses.
*
* @param buf the {@link ByteBuf} to write into.
* @param msg the message to encode.
*/
protected abstract void encodeHeader(ByteBuf buf, M msg);
}
Source
Frequently Asked Questions
What is the AbstractBinaryMemcacheEncoder class?
AbstractBinaryMemcacheEncoder is a class in the netty codebase, defined in codec-memcache/src/main/java/io/netty/handler/codec/memcache/binary/AbstractBinaryMemcacheEncoder.java.
Where is AbstractBinaryMemcacheEncoder defined?
AbstractBinaryMemcacheEncoder is defined in codec-memcache/src/main/java/io/netty/handler/codec/memcache/binary/AbstractBinaryMemcacheEncoder.java at line 27.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free