Source/NFX.Erlang/ErlOutputStream.cs
/// <summary>
/// Write a string to the stream
/// </summary>
Write a string to the stream
Write a string to the stream
public void WriteString(string s, Encoding encoding = null)
    {
      int len = s.Length;
      if (len == 0)
        WriteNil();
      else
      {
        var bytebuf = (encoding ?? Encoding.ASCII).GetBytes(s);
        if (bytebuf.Length < 0xffff)
        {
          write(ErlExternalTag.String);
          Write2BE(len);
          Write(bytebuf);
        }
        else
        {
          WriteListHead(len);
          foreach (var b in bytebuf)
            Write(b);
          WriteNil();
        }
      }
    }
public void WriteString ( string s , Encoding encoding = null ) { int len = s . Length ; if ( len == 0 ) WriteNil ( ) ; else { var bytebuf = ( encoding ?? Encoding . ASCII ) . GetBytes ( s ) ; if ( bytebuf . Length < 0xffff ) { write ( ErlExternalTag . String ) ; Write2BE ( len ) ; Write ( bytebuf ) ; } else { WriteListHead ( len ) ; foreach ( var b in bytebuf ) Write ( b ) ; WriteNil ( ) ; } } }
Write a string to the stream
Write a string to the stream
s
string
encoding
Encoding