protected override void End() { binaryWriter.Seek(0, SeekOrigin.Begin); buf.Position = 0; UInt16 len = (UInt16)(buf.Length - buf.Position - 2); binaryWriter.Write(len); buf.Flush(); DEBUG.Info(BitConverter.ToString(buf.GetBuffer(), 0, (int)buf.Length)); // DEBUG.Info ("after end len=" + buf.Length + " p=" + buf.Position + " size=" + (len)); buf.Position = 0; }