本文整理匯總了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++;
}
}
示例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;
//.........這裏部分代碼省略.........