当前位置: 首页>>代码示例>>C#>>正文


C# XmlTextReader.ContinueReadFromBuffer方法代码示例

本文整理汇总了C#中System.Xml.XmlTextReader.ContinueReadFromBuffer方法的典型用法代码示例。如果您正苦于以下问题:C# XmlTextReader.ContinueReadFromBuffer方法的具体用法?C# XmlTextReader.ContinueReadFromBuffer怎么用?C# XmlTextReader.ContinueReadFromBuffer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.XmlTextReader的用法示例。


在下文中一共展示了XmlTextReader.ContinueReadFromBuffer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FinishIncrementalRead

 internal void FinishIncrementalRead(XmlTextReader reader) {
     if (null != _BinHexDecoder) {
         _BinHexDecoder.Flush();
     }
     if (null != _Base64Decoder) {
         _Base64Decoder.Flush();
     }
     while(true) {
         if (_nPos == _nUsed) {
             _nStart = _nPos;
             int i = Read();
             if (0 == i ) return;
         }
         if ('<' == _achText[_nPos]) {
             if (!reader.ContinueReadFromBuffer(ScanMarkup())) {
                 return;
             }
         }
         _nPos++;
     }
 }
开发者ID:ArildF,项目名称:masters,代码行数:21,代码来源:xmlscanner.cs

示例2: IncrementalRead

        internal int IncrementalRead(object destBuffer, int index, int count, XmlTextReader reader,IncrementalReadType readType ) {
            int nStart = _nPos;
            int initialDestStartIndex = index;
            int loopCount;
            int offset = index;
            int lineNumber = LineNum;
            int linePosition = LinePos;
            bool lastCharD = false;
            int i;

            loopCount = GetCharCount(count, readType);
            try {
                for(i = 0; i < loopCount; i++) {
                    if (_nPos == _nUsed) {
                                index = IncrementalReadHelper(destBuffer, index, readType, nStart, count - index + offset);
                                _nStart = _nPos;
                                int diff = count - index + offset ;
                                if (IncrementalReadType.Base64 == readType || IncrementalReadType.BinHex == readType ) {
                                    loopCount += GetCharCount(diff , readType);
                                }
                                if (diff == 0)
                                    return index - initialDestStartIndex;
                                if (Read() == 0)
                                   throw new XmlException(Res.Xml_UnexpectedEOF, XmlToken.ToString(XmlToken.TAG), LineNum, LinePos);
                                nStart = _nPos;
                                lineNumber = LineNum;
                                linePosition = LinePos;

                     }

                    switch(_achText[_nPos]) {
                        case '<':
                            {
                                index = IncrementalReadHelper(destBuffer, index, readType, nStart, count - index + offset);
                                int diff = count - index + offset ;
                                if (IncrementalReadType.Base64 == readType || IncrementalReadType.BinHex == readType ) {
                                    loopCount += GetCharCount(diff , readType);
                                }
                                if (diff == 0)
                                    return index - initialDestStartIndex;
                            }

                            // Refill buffer to ensure that the calls from ContinueReadFromBuffer will not cause
                            // The buffer size to increase
                            _nStart = _nPos;
                            Read(); //as its not end of input we just calling read to make sure buffer is enough full so no need to check the result

                            nStart = _nPos;
                            lineNumber = LineNum;
                            linePosition = LinePos;

                            // set ReadBufferConsistency in case name of the tag is bigger than 4k. Highly unlikely but possible.
                            if (reader.ContinueReadFromBuffer(ScanMarkup())) {
                                // We can continue filling up the buffer but _nPos might have moved.
                                if (nStart < _nPos) {
                                    // Some stuff was read by the textReader;
                                    if (_nPos - nStart > loopCount - (index - offset)) {
                                        _nPos = nStart + loopCount - (index - offset);
                                        i = loopCount - 1;
                                        _nStart = _nPos;
                                    }
                                    else {
                                        i += _nPos - nStart -1;
                                    }
                                } //if (nStart < _nPos)
                            }
                            else {
                                return index - initialDestStartIndex;
                            } // if ... else ...
                            lastCharD = false;
                            break;
                        case (char)0xA:
                            if (!lastCharD) {
                                ++_nLineNum;
                            }
                            _nPos++;
                            _nLinePos = _nPos;
                            lastCharD = false;
                            break;
                        case (char)0xD:
                            ++_nLineNum;
                            lastCharD = true;
                            _nPos++;
                            _nLinePos = _nPos;
                            break;
                        default:
                            _nPos++;
                            lastCharD = false;
                            break;
                    }

                    if (i == loopCount -1) {
                        index = IncrementalReadHelper(destBuffer, index, readType, nStart, count - index + offset);

                        int diff = count - index + offset ;

                        if (IncrementalReadType.Base64 == readType || IncrementalReadType.BinHex == readType ) {
                          loopCount += GetCharCount(diff , readType);
                        }
                        nStart = _nStart = _nPos;
//.........这里部分代码省略.........
开发者ID:ArildF,项目名称:masters,代码行数:101,代码来源:xmlscanner.cs


注:本文中的System.Xml.XmlTextReader.ContinueReadFromBuffer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。