Beispiel #1
0
 /// <summary>
 /// 写入字符串
 /// </summary>
 /// <param name="stream">The stream containing the string to write.</param>
 /// <param name="value">The string to write.</param>
 public static void WriteString(this Stream stream, string value)
 {
     System.Text.Encoding enc = new MqttEncoding();
     byte[] stringBytes       = enc.GetBytes(value);
     stream.Write(stringBytes, 0, stringBytes.Length);
 }
Beispiel #2
0
 /// <summary>
 /// 写入字符串
 /// </summary>
 /// <param name="buffer">The stream containing the string to write.</param>
 /// <param name="value">The string to write.</param>
 public static void WriteString(this IByteBuffer buffer, string value)
 {
     System.Text.Encoding enc = new MqttEncoding();
     byte[] stringBytes       = enc.GetBytes(value);
     buffer.WriteBytes(stringBytes, 0, stringBytes.Length);
 }
Beispiel #3
0
 /// <summary>
 ///     Writes the MQTT string.
 /// </summary>
 /// <param name="stringStream">The stream containing the string to write.</param>
 /// <param name="value">The string to write.</param>
 public static void WriteString(this Stream stringStream, string value)
 {
     System.Text.Encoding enc = new MqttEncoding();
     byte[] stringBytes = enc.GetBytes(value);
     stringStream.Write(stringBytes, 0, stringBytes.Length);
 }