code: public static ByteBuffer stringToBytes(String s) {
      return Unpooled.wrappedBuffer(s.getBytes(StandardCharsets.UTF_8)).nioBuffer();
    }
docs: Convert the given string to a byte buffer. The resulting buffer can be
  converted back to the same string through {@link #bytesToString(ByteBuffer)}.