src/AnvilPacker/Data/IO/DataWriter.cs
/// <summary> Writes an UTF8 string with a custom length prefix. </summary>
Writes an UTF8 string with a custom length prefix.
Writes an UTF8 string with a custom length prefix .
public void WriteString(string str, Action<DataWriter, int> writePrefixLen)
        {
            var enc = Encoding.UTF8;
            int len = enc.GetByteCount(str);
            var buf = len < 256 ? stackalloc byte[len] : new byte[len];
            enc.GetBytes(str, buf);
            writePrefixLen(this, len);
            WriteBytes(buf);
        }
public void WriteString ( string str , Action < DataWriter , int > writePrefixLen ) { var enc = Encoding . UTF8 ; int len = enc . GetByteCount ( str ) ; var buf = len < 256 ? stackalloc byte [ len ] : new byte [ len ] ; enc . GetBytes ( str , buf ) ; writePrefixLen ( this , len ) ; WriteBytes ( buf ) ; }
Writes an UTF8 string with a custom length prefix.
Writes an UTF8 string with a custom length prefix .
str
string
writePrefixLen
Action<DataWriter, int>