StompSubframeEncoder Class — netty Architecture
Architecture documentation for the StompSubframeEncoder class in StompSubframeEncoder.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 453c4953_0f2f_6759_71f5_48a24c8c51c0["StompSubframeEncoder"] b1e06e19_2129_f315_5884_8660d82dcd68["StompSubframeEncoder.java"] 453c4953_0f2f_6759_71f5_48a24c8c51c0 -->|defined in| b1e06e19_2129_f315_5884_8660d82dcd68 a0d30519_186d_aafa_c8a6_455f200235df["StompSubframeEncoder()"] 453c4953_0f2f_6759_71f5_48a24c8c51c0 -->|method| a0d30519_186d_aafa_c8a6_455f200235df 4300cd27_b0e3_023a_2081_dbc750ab030a["encode()"] 453c4953_0f2f_6759_71f5_48a24c8c51c0 -->|method| 4300cd27_b0e3_023a_2081_dbc750ab030a aaf77b0b_b303_07b9_979b_61f2a9506199["Object()"] 453c4953_0f2f_6759_71f5_48a24c8c51c0 -->|method| aaf77b0b_b303_07b9_979b_61f2a9506199 7a6fe7fa_2323_a56f_81bb_0d7fe5ec88f5["headersSubFrameSize()"] 453c4953_0f2f_6759_71f5_48a24c8c51c0 -->|method| 7a6fe7fa_2323_a56f_81bb_0d7fe5ec88f5 54149930_1362_82ca_47cf_8b8c00eead94["ByteBuf()"] 453c4953_0f2f_6759_71f5_48a24c8c51c0 -->|method| 54149930_1362_82ca_47cf_8b8c00eead94 24221f37_d904_c246_ea24_6ac0a19ecb27["encodeHeaders()"] 453c4953_0f2f_6759_71f5_48a24c8c51c0 -->|method| 24221f37_d904_c246_ea24_6ac0a19ecb27 aab7d673_d0f1_5ff0_6f7d_923fbc02d7c7["shouldEscape()"] 453c4953_0f2f_6759_71f5_48a24c8c51c0 -->|method| aab7d673_d0f1_5ff0_6f7d_923fbc02d7c7 77df60cb_8d18_5637_8d69_b0f2fccec89f["CharSequence()"] 453c4953_0f2f_6759_71f5_48a24c8c51c0 -->|method| 77df60cb_8d18_5637_8d69_b0f2fccec89f 91613d8b_4c2d_6032_823e_049549a9068b["AppendableCharSequence()"] 453c4953_0f2f_6759_71f5_48a24c8c51c0 -->|method| 91613d8b_4c2d_6032_823e_049549a9068b
Relationship Graph
Source Code
codec-stomp/src/main/java/io/netty/handler/codec/stomp/StompSubframeEncoder.java lines 53–251
public class StompSubframeEncoder extends MessageToMessageEncoder<StompSubframe> {
private static final int ESCAPE_HEADER_KEY_CACHE_LIMIT = 32;
private static final float DEFAULT_LOAD_FACTOR = 0.75f;
private static final FastThreadLocal<LinkedHashMap<CharSequence, CharSequence>> ESCAPE_HEADER_KEY_CACHE =
new FastThreadLocal<LinkedHashMap<CharSequence, CharSequence>>() {
@Override
protected LinkedHashMap<CharSequence, CharSequence> initialValue() throws Exception {
LinkedHashMap<CharSequence, CharSequence> cache = new LinkedHashMap<CharSequence, CharSequence>(
ESCAPE_HEADER_KEY_CACHE_LIMIT, DEFAULT_LOAD_FACTOR, true) {
@Override
protected boolean removeEldestEntry(Entry eldest) {
return size() > ESCAPE_HEADER_KEY_CACHE_LIMIT;
}
};
cache.put(ACCEPT_VERSION, ACCEPT_VERSION);
cache.put(HOST, HOST);
cache.put(LOGIN, LOGIN);
cache.put(PASSCODE, PASSCODE);
cache.put(HEART_BEAT, HEART_BEAT);
cache.put(VERSION, VERSION);
cache.put(SESSION, SESSION);
cache.put(SERVER, SERVER);
cache.put(DESTINATION, DESTINATION);
cache.put(ID, ID);
cache.put(ACK, ACK);
cache.put(TRANSACTION, TRANSACTION);
cache.put(RECEIPT, RECEIPT);
cache.put(MESSAGE_ID, MESSAGE_ID);
cache.put(SUBSCRIPTION, SUBSCRIPTION);
cache.put(RECEIPT_ID, RECEIPT_ID);
cache.put(MESSAGE, MESSAGE);
cache.put(CONTENT_LENGTH, CONTENT_LENGTH);
cache.put(CONTENT_TYPE, CONTENT_TYPE);
return cache;
}
};
public StompSubframeEncoder() {
super(StompSubframe.class);
}
@Override
protected void encode(ChannelHandlerContext ctx, StompSubframe msg, List<Object> out) throws Exception {
if (msg instanceof StompFrame) {
StompFrame stompFrame = (StompFrame) msg;
ByteBuf buf = encodeFullFrame(stompFrame, ctx);
out.add(convertFullFrame(stompFrame, buf));
} else if (msg instanceof StompHeadersSubframe) {
StompHeadersSubframe stompHeadersSubframe = (StompHeadersSubframe) msg;
ByteBuf buf = ctx.alloc().buffer(headersSubFrameSize(stompHeadersSubframe));
encodeHeaders(stompHeadersSubframe, buf);
out.add(convertHeadersSubFrame(stompHeadersSubframe, buf));
} else if (msg instanceof StompContentSubframe) {
StompContentSubframe stompContentSubframe = (StompContentSubframe) msg;
ByteBuf buf = encodeContent(stompContentSubframe, ctx);
out.add(convertContentSubFrame(stompContentSubframe, buf));
}
}
/**
* An extension method to convert a STOMP encoded buffer to a different message type
* based on an original {@link StompFrame} full frame.
*
* <p>By default an encoded buffer is returned as is.
*/
protected Object convertFullFrame(StompFrame original, ByteBuf encoded) {
return encoded;
}
/**
* An extension method to convert a STOMP encoded buffer to a different message type
* based on an original {@link StompHeadersSubframe} headers sub frame.
*
* <p>By default an encoded buffer is returned as is.
Source
Frequently Asked Questions
What is the StompSubframeEncoder class?
StompSubframeEncoder is a class in the netty codebase, defined in codec-stomp/src/main/java/io/netty/handler/codec/stomp/StompSubframeEncoder.java.
Where is StompSubframeEncoder defined?
StompSubframeEncoder is defined in codec-stomp/src/main/java/io/netty/handler/codec/stomp/StompSubframeEncoder.java at line 53.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free