public static bool Serialize(IWriteableStreamSync stream, Int32 i) { var iNetworkOrder = IPAddress.HostToNetworkOrder(i); var bytes = BitConverter.GetBytes(iNetworkOrder); return(stream.Write(bytes, 0, bytes.Length)); }
public static bool Serialize(IWriteableStreamSync stream, string s) { // convert string to bytes var bytes = m_asciiEncoder.GetBytes(s); // max length check Debug.Assert(bytes.Length <= MAX_STRING_LEN); int length = Math.Min(bytes.Length, MAX_STRING_LEN); // first send length of string, then send string return(Serialize(stream, length) && stream.Write(bytes, 0, length)); }
public SerializationAdapter(IWriteableStreamSync stream) { m_outStream = stream; }