private static void encodeHeader ( CharSequence name , CharSequence value , ByteBuf buf ) { final int nameLen = name . length ( ) ; final int valueLen = value . length ( ) ; final int entryLen = nameLen + valueLen + 4 ; buf . ensureWritable ( entryLen ) ; int offset = buf . writerIndex ( ) ; writeAscii ( buf , offset , name , nameLen ) ; offset += nameLen ; buf . setByte ( offset ++ , ' ' ) ; buf . setByte ( offset ++ , ' ' ) ; writeAscii ( buf , offset , value , valueLen ) ; offset += valueLen ; buf . setByte ( offset ++ , ' ' ) ; buf . setByte ( offset ++ , ' ' ) ; buf . writerIndex ( offset ) ; }
Copied from io . netty . handler . codec . http . HttpHeadersEncoder