Write() public method

public Write ( byte b, int a, int c ) : void
b byte
a int
c int
return void
Ejemplo n.º 1
0
        /// <summary>
        ///     Write the JSON message to the output stream.
        /// </summary>
        /// <param name="message">
        ///     The message to write.
        /// </param>
        private void WriteJsonMessage(string message)
        {
            // Build the header message.
            var header     = string.Format("Content-Length: {0}{1}{2}{1}{2}", message.Length, (char)0x0D, (char)0x0A);
            var headerData = Encoding.UTF8.GetBytes(header);

            SourceStream.Write(headerData, 0, headerData.Length);

            // Write the body data.
            var bodyData = Encoding.UTF8.GetBytes(message);

            SourceStream.Write(bodyData, 0, bodyData.Length);

            SourceStream.Flush();

            // debug the new message.
            if (DebugStream != null)
            {
                lock (DebugStream)
                {
                    DebugStream.WriteLine("*****************************************");
                    DebugStream.WriteLine(" Direction: {0}", Direction);
                    DebugStream.WriteLine(" Timestamp: {0}", DateTime.Now);
                    DebugStream.WriteLine("*****************************************");
                    DebugStream.WriteLine(message);
                    DebugStream.WriteLine("*****************************************");
                    DebugStream.Flush();
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Writes 4 floating point bytes at a time, inputting from <see cref="AbstractPcmConversionStream.BytesPerSample"/>
        /// bytes per PCM sample write.
        /// </summary>
        /// <param name="buffer"></param>
        /// <param name="offset"></param>
        /// <param name="count"></param>
        protected override void InternalWrite(byte[] buffer, int offset, int count)
        {
            var wrote = 0;

            while (wrote < count)
            {
                PCMToFloat(buffer, offset + wrote, tempBuffer, 0);
                SourceStream.Write(tempBuffer, 0, sizeof(float));
                wrote += BytesPerSample;
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Writes to the underlying stream
 /// </summary>
 public override void Write(byte[] buffer, int offset, int count)
 {
     SourceStream.Write(buffer, offset, count);
 }