List of usage examples for io.netty.buffer ByteBufUtil utf8Bytes
public static int utf8Bytes(final CharSequence seq)
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);//from w ww . ja v a 2 s . c o m ByteBufUtil.reserveAndWriteUtf8(byteBuf, s, length); }