public void WriteString32()

in src/nms-api/Util/EndianBinaryWriter.cs [200:225]


        public void WriteString32(String text)
        {
            if (text != null)
            {
                char[] charr = text.ToCharArray();
                uint utfLength = CountUtf8Bytes(charr);

                if (utfLength > int.MaxValue)
                {
                    throw new IOException(
                        String.Format(
                            "Cannot marshall an encoded string longer than: {0} bytes, supplied" +
                            "string requires: {1} characters to encode", int.MaxValue, utfLength));
                }

                byte[] bytearr = new byte[utfLength];
                encodeUTF8toBuffer(charr, bytearr);

                Write(utfLength);
                Write(bytearr);
            }
            else
            {
                Write((int) -1);
            }
        }