Move encode of chunked content to an extra method, this allows for inline. Related to #1812
encode of chunked content is not the most common pattern so moving it to an extra method makes it possible to inline the rest as it is a smaller method now.
This commit is contained in:
parent
92cec8d2ac
commit
845a7c5753
@ -93,6 +93,14 @@ public abstract class HttpObjectEncoder<H extends HttpMessage> extends MessageTo
|
||||
state = ST_INIT;
|
||||
}
|
||||
} else if (state == ST_CONTENT_CHUNK) {
|
||||
encodeChunkedContent(ctx, msg, contentLength, out);
|
||||
} else {
|
||||
throw new Error();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void encodeChunkedContent(ChannelHandlerContext ctx, Object msg, int contentLength, List<Object> out) {
|
||||
if (contentLength > 0) {
|
||||
byte[] length = Integer.toHexString(contentLength).getBytes(CharsetUtil.US_ASCII);
|
||||
ByteBuf buf = ctx.alloc().buffer(length.length + 2);
|
||||
@ -123,10 +131,6 @@ public abstract class HttpObjectEncoder<H extends HttpMessage> extends MessageTo
|
||||
out.add(EMPTY_BUFFER);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new Error();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user