System.Xml.XmlUTF8TextReader.SetInput C# (CSharp) Method

SetInput() public method

public SetInput ( byte buffer, int offset, int count, Encoding encoding, XmlDictionaryReaderQuotas quotas, OnXmlDictionaryReaderClose onClose ) : void
buffer byte
offset int
count int
encoding Encoding
quotas XmlDictionaryReaderQuotas
onClose OnXmlDictionaryReaderClose
return void
        public void SetInput(byte[] buffer, int offset, int count, Encoding encoding, XmlDictionaryReaderQuotas quotas, OnXmlDictionaryReaderClose onClose)
        {
            if (buffer == null)
                throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException(nameof(buffer)));
            if (offset < 0)
                throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.ValueMustBeNonNegative)));
            if (offset > buffer.Length)
                throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.OffsetExceedsBufferSize, buffer.Length)));
            if (count < 0)
                throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.ValueMustBeNonNegative)));
            if (count > buffer.Length - offset)
                throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.SizeExceedsRemainingBufferSpace, buffer.Length - offset)));
            MoveToInitial(quotas, onClose);
            ArraySegment<byte> seg = EncodingStreamWrapper.ProcessBuffer(buffer, offset, count, encoding);
            BufferReader.SetBuffer(seg.Array, seg.Offset, seg.Count, null, null);
            _buffered = true;
        }

Same methods

XmlUTF8TextReader::SetInput ( Stream stream, Encoding encoding, XmlDictionaryReaderQuotas quotas, OnXmlDictionaryReaderClose onClose ) : void

Usage Example

 static public XmlDictionaryReader CreateTextReader(Stream stream, Encoding encoding,
                                                    XmlDictionaryReaderQuotas quotas,
                                                    OnXmlDictionaryReaderClose onClose)
 {
     XmlUTF8TextReader reader = new XmlUTF8TextReader();
     reader.SetInput(stream, encoding, quotas, onClose);
     return reader;
 }
All Usage Examples Of System.Xml.XmlUTF8TextReader::SetInput