code: public static void writeShortString(ByteBuffer buffer, String s) {
          if (s == null) {
              buffer.putShort((short) -1);
          } else if (s.length() > Short.MAX_VALUE) {
              throw new IllegalArgumentException("String exceeds the maximum size of " + Short.MAX_VALUE + ".");
          } else {
              byte[] data = getBytes(s); //topic support non-ascii character
              buffer.putShort((short) data.length);
              buffer.put(data);
          }
      }
docs: Write a size prefixed string where the size is stored as a 2 byte
  short
  
  @param buffer The buffer to write to
  @param s      The string to write