public void Write(ByteBuffer buffer) { // TODO: Move into decorator. if (_ioTraceLog.IsDebugEnabled) { _ioTraceLog.Debug(String.Format("WRITE {0}", buffer)); } _lowerChannel.Write(buffer); }
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)); }
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); }