Improve performance of encodeHeader
This commit is contained in:
parent
7e3a01cc51
commit
9633769909
@ -125,11 +125,17 @@ public abstract class HttpObjectEncoder<H extends HttpMessage> extends MessageTo
|
||||
}
|
||||
|
||||
private static void encodeHeader(ByteBuf buf, String header, String value) {
|
||||
buf.writeBytes(header.getBytes(CharsetUtil.US_ASCII));
|
||||
encodeAscii(header, buf);
|
||||
buf.writeBytes(HEADER_SEPARATOR);
|
||||
buf.writeBytes(value.getBytes(CharsetUtil.US_ASCII));
|
||||
encodeAscii(value, buf);
|
||||
buf.writeBytes(CRLF);
|
||||
}
|
||||
|
||||
private static void encodeAscii(String s, ByteBuf buf) {
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
buf.writeByte(s.charAt(i));
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void encodeInitialLine(ByteBuf buf, H message) throws Exception;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user