Ejemplo n.º 1
0
        public void Write(ByteBuffer buffer)
        {
            // TODO: Move into decorator.
            if (_ioTraceLog.IsDebugEnabled)
            {
                _ioTraceLog.Debug(String.Format("WRITE {0}", buffer));
            }

            _lowerChannel.Write(buffer);
        }
Ejemplo n.º 2
0
 public void Write(IDataBlock o)
 {
     // TODO: Refactor to decorator.
     if (_protocolTraceLog.IsDebugEnabled)
     {
         _protocolTraceLog.Debug(String.Format("WRITE {0}", o));
     }
     // we should be doing an async write, but apparently
     // the mentalis library doesn't queue async read/writes
     // correctly and throws random IOException's. Stay sync for a while
     //_byteChannel.BeginWrite(Encode(o), OnAsyncWriteDone, null);
     _byteChannel.Write(Encode(o));
 }
Ejemplo n.º 3
0
        public byte[] End()
        {
            _writer.Flush();
            var bytes = _stream.ToArray();

            _writer.Close();
            _writer = null;
            _stream = null;

            if (OutboundChannel != null && bytes.Length > 0)
            {
                OutboundChannel.Write(bytes);
            }

            return(bytes);
        }