public void SetOutput(Stream stream, IXmlDictionary dictionary, XmlBinaryWriterSession session, bool ownsStream) { if (stream == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("stream")); } if (this.writer == null) { this.writer = new XmlBinaryNodeWriter(); } this.writer.SetOutput(stream, dictionary, session, ownsStream); base.SetOutput(this.writer); }
public void WriteTo(XmlBinaryNodeWriter writer) { if (this.captureText != null) { writer.WriteText(this.captureText); this.captureText = null; } else if (this.captureXText != null) { writer.WriteText(this.captureXText); this.captureXText = null; } else if (this.captureStream != null) { writer.WriteBase64Text(null, 0, this.captureStream.GetBuffer(), 0, (int)this.captureStream.Length); this.captureStream = null; } else { writer.WriteEmptyText(); } }
public void SetOutput(Stream stream, IXmlDictionary dictionary, XmlBinaryWriterSession session, bool ownsStream) { if (stream == null) throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException(nameof(stream))); if (_writer == null) _writer = new XmlBinaryNodeWriter(); _writer.SetOutput(stream, dictionary, session, ownsStream); SetOutput(_writer); }
public void WriteTo(XmlBinaryNodeWriter writer) { if (_captureText != null) { writer.WriteText(_captureText); _captureText = null; } else if (_captureXText != null) { writer.WriteText(_captureXText); _captureXText = null; } else if (_captureStream != null) { ArraySegment<byte> arraySegment; bool result = _captureStream.TryGetBuffer(out arraySegment); DiagnosticUtility.DebugAssert(result, ""); writer.WriteBase64Text(null, 0, arraySegment.Array, arraySegment.Offset, arraySegment.Count); _captureStream = null; } else { writer.WriteEmptyText(); } }
public void WriteTo(XmlBinaryNodeWriter writer) { if (captureText != null) { writer.WriteText(captureText); captureText = null; } else if (captureXText != null) { writer.WriteText(captureXText); captureXText = null; } else if (captureStream != null) { writer.WriteBase64Text(null, 0, captureStream.GetBuffer(), 0, (int)captureStream.Length); captureStream = null; } else { writer.WriteEmptyText(); } }