List of usage examples for io.netty.buffer ByteBufUtil reserveAndWriteUtf8
public static int reserveAndWriteUtf8(ByteBuf buf, CharSequence seq, int reserveBytes)
From source file:org.springframework.cloud.gateway.rsocket.support.Metadata.java
License:Apache License
private static void encodeString(ByteBuf byteBuf, String s) { int length = NumberUtils.requireUnsignedByte(ByteBufUtil.utf8Bytes(s)); byteBuf.writeByte(length);/* ww w .j a v a2s.c o m*/ ByteBufUtil.reserveAndWriteUtf8(byteBuf, s, length); }