public void SetInput(byte[] buffer, int offset, int count, Encoding encoding, XmlDictionaryReaderQuotas quotas, OnXmlDictionaryReaderClose onClose)
        {
            if (buffer == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("buffer"));
            }
            if (offset < 0)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("offset", System.Runtime.Serialization.SR.GetString("ValueMustBeNonNegative")));
            }
            if (offset > buffer.Length)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("offset", System.Runtime.Serialization.SR.GetString("OffsetExceedsBufferSize", new object[] { buffer.Length })));
            }
            if (count < 0)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("count", System.Runtime.Serialization.SR.GetString("ValueMustBeNonNegative")));
            }
            if (count > (buffer.Length - offset))
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("count", System.Runtime.Serialization.SR.GetString("SizeExceedsRemainingBufferSpace", new object[] { buffer.Length - offset })));
            }
            this.MoveToInitial(quotas, onClose);
            ArraySegment <byte> segment = EncodingStreamWrapper.ProcessBuffer(buffer, offset, count, encoding);

            base.BufferReader.SetBuffer(segment.Array, segment.Offset, segment.Count, null, null);
            this.buffered = true;
        }
 public void SetInput(Stream stream, Encoding encoding, XmlDictionaryReaderQuotas quotas, OnXmlDictionaryReaderClose onClose)
 {
     if (stream == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("stream");
     }
     this.MoveToInitial(quotas, onClose);
     stream = new EncodingStreamWrapper(stream, encoding);
     base.BufferReader.SetBuffer(stream, null, null);
     this.buffered = false;
 }
Ejemplo n.º 3
0
        public void SetOutput(Stream stream, Encoding encoding, bool ownsStream)
        {
            ArgumentNullException.ThrowIfNull(stream);
            ArgumentNullException.ThrowIfNull(encoding);

            if (encoding.WebName != Encoding.UTF8.WebName)
            {
                stream = new EncodingStreamWrapper(stream, encoding, true);
            }

            _writer ??= new XmlUTF8NodeWriter();
            _writer.SetOutput(stream, ownsStream, encoding);
            SetOutput(_writer);
        }
Ejemplo n.º 4
0
        public void SetOutput(Stream stream, Encoding encoding, bool ownsStream)
        {
            if (stream == null)
                throw new ArgumentNullException("stream");
            if (encoding == null)
                throw new ArgumentNullException("encoding");
            if (encoding.WebName != Encoding.UTF8.WebName)
            {
                stream = new EncodingStreamWrapper(stream, encoding, true);
            }

            if (_writer == null)
            {
                _writer = new XmlUTF8NodeWriter();
            }
            _writer.SetOutput(stream, ownsStream, encoding);
            SetOutput(_writer);
        }
        public void SetOutput(Stream stream, Encoding encoding, bool ownsStream)
        {
            if (stream == null)
                throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("stream");
            if (encoding == null)
                throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("encoding");
            if (encoding.WebName != Encoding.UTF8.WebName)
            {
                stream = new EncodingStreamWrapper(stream, encoding, true);
            }

            if (writer == null)
            {
                writer = new XmlUTF8NodeWriter();
            }
            writer.SetOutput(stream, ownsStream, encoding);
            SetOutput(writer);
        }
Ejemplo n.º 6
0
 public void SetOutput(Stream stream, Encoding encoding, bool ownsStream)
 {
     if (stream == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("stream");
     }
     if (encoding == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("encoding");
     }
     if (encoding.WebName != Encoding.UTF8.WebName)
     {
         stream = new EncodingStreamWrapper(stream, encoding, true);
     }
     if (this.writer == null)
     {
         this.writer = new XmlUTF8NodeWriter();
     }
     this.writer.SetOutput(stream, ownsStream, encoding);
     base.SetOutput(this.writer);
 }
 public void SetOutput(Stream stream, Encoding encoding, bool ownsStream)
 {
     if (stream == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("stream");
     }
     if (encoding == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("encoding");
     }
     if (encoding.WebName != Encoding.UTF8.WebName)
     {
         stream = new EncodingStreamWrapper(stream, encoding, true);
     }
     if (this.writer == null)
     {
         this.writer = new XmlUTF8NodeWriter();
     }
     this.writer.SetOutput(stream, ownsStream, encoding);
     base.SetOutput(this.writer);
 }
Ejemplo n.º 8
0
        public void SetOutput(Stream stream, Encoding encoding, bool ownsStream)
        {
            if (stream == null)
            {
                throw new ArgumentNullException(nameof(stream));
            }
            if (encoding == null)
            {
                throw new ArgumentNullException(nameof(encoding));
            }
            if (encoding.WebName != Encoding.UTF8.WebName)
            {
                stream = new EncodingStreamWrapper(stream, encoding, true);
            }

            if (_writer == null)
            {
                _writer = new XmlUTF8NodeWriter();
            }
            _writer.SetOutput(stream, ownsStream, encoding);
            SetOutput(_writer);
        }
Ejemplo n.º 9
0
 public void SetInput(Stream stream, Encoding encoding, XmlDictionaryReaderQuotas quotas, OnXmlDictionaryReaderClose onClose)
 {
     if (stream == null)
         throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("stream");
     MoveToInitial(quotas, onClose);
     stream = new EncodingStreamWrapper(stream, encoding);
     BufferReader.SetBuffer(stream, null, null);
     _buffered = false;
 }
 public void SetInput(Stream stream, Encoding encoding, XmlDictionaryReaderQuotas quotas, OnXmlDictionaryReaderClose onClose)
 {
     if (stream == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("stream");
     }
     this.MoveToInitial(quotas, onClose);
     stream = new EncodingStreamWrapper(stream, encoding);
     base.BufferReader.SetBuffer(stream, null, null);
     this.buffered = false;
 }