Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / ndp / fx / src / Xml / System / Xml / Core / IncrementalReadDecoders.cs / 1 / IncrementalReadDecoders.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- using System.Diagnostics; namespace System.Xml { // // IncrementalReadDecoder abstract class // internal abstract class IncrementalReadDecoder { internal abstract int DecodedCount { get; } internal abstract bool IsFull { get; } internal abstract void SetNextOutputBuffer( Array array, int offset, int len ); internal abstract int Decode( char[] chars, int startPos, int len ); internal abstract int Decode( string str, int startPos, int len ); internal abstract void Reset(); } // // Dummy IncrementalReadDecoder // internal class IncrementalReadDummyDecoder : IncrementalReadDecoder { internal override int DecodedCount { get { return -1; } } internal override bool IsFull { get { return false; } } internal override void SetNextOutputBuffer( Array array, int offset, int len ) {} internal override int Decode( char[] chars, int startPos, int len ) { return len; } internal override int Decode( string str, int startPos, int len ) { return len; } internal override void Reset() {} } // // IncrementalReadDecoder for ReadChars // internal class IncrementalReadCharsDecoder : IncrementalReadDecoder { char[] buffer; int startIndex; int curIndex; int endIndex; internal IncrementalReadCharsDecoder() { } internal override int DecodedCount { get { return curIndex - startIndex; } } internal override bool IsFull { get { return curIndex == endIndex; } } internal override int Decode( char[] chars, int startPos, int len ) { Debug.Assert( chars != null ); Debug.Assert( len >= 0 ); Debug.Assert( startPos >= 0 ); Debug.Assert( chars.Length - startPos >= len ); Debug.Assert( len > 0 ); int copyCount = endIndex - curIndex; if ( copyCount > len ) { copyCount = len; } Buffer.BlockCopy( chars, startPos * 2, buffer, curIndex * 2, copyCount * 2 ); curIndex += copyCount; return copyCount; } internal override int Decode( string str, int startPos, int len ) { Debug.Assert( str != null ); Debug.Assert( len >= 0 ); Debug.Assert( startPos >= 0 ); Debug.Assert( str.Length - startPos >= len ); Debug.Assert( len > 0 ); int copyCount = endIndex - curIndex; if ( copyCount > len ) { copyCount = len; } str.CopyTo( startPos, buffer, curIndex, copyCount ); curIndex += copyCount; return copyCount; } internal override void Reset() { } internal override void SetNextOutputBuffer( Array buffer, int index, int count ) { Debug.Assert( buffer != null ); Debug.Assert( count >= 0 ); Debug.Assert( index >= 0 ); Debug.Assert( buffer.Length - index >= count ); Debug.Assert( ( buffer as char[] ) != null ); this.buffer = (char[])buffer; this.startIndex = index; this.curIndex = index; this.endIndex = index + count; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DBSchemaRow.cs
- BinaryKeyIdentifierClause.cs
- EventlogProvider.cs
- CodeConstructor.cs
- AdPostCacheSubstitution.cs
- SafeHandles.cs
- EventOpcode.cs
- DbModificationCommandTree.cs
- DefaultSection.cs
- UnsafeNativeMethodsPenimc.cs
- UniqueConstraint.cs
- XmlStringTable.cs
- MimeMapping.cs
- MessageContractAttribute.cs
- CacheManager.cs
- GACMembershipCondition.cs
- PassportAuthentication.cs
- SortAction.cs
- ResourceManager.cs
- FormViewDeleteEventArgs.cs
- ImmutableObjectAttribute.cs
- Oid.cs
- DbParameterCollectionHelper.cs
- WebPartDeleteVerb.cs
- KerberosTicketHashIdentifierClause.cs
- EventSinkHelperWriter.cs
- BehaviorEditorPart.cs
- TextParagraphView.cs
- LoginName.cs
- shaperfactoryquerycacheentry.cs
- HttpModuleActionCollection.cs
- DNS.cs
- Thumb.cs
- InputBinder.cs
- ClassValidator.cs
- WriterOutput.cs
- SelectionEditingBehavior.cs
- TableDetailsRow.cs
- ReflectionTypeLoadException.cs
- ColorMap.cs
- Gdiplus.cs
- QilScopedVisitor.cs
- CodeBinaryOperatorExpression.cs
- XmlObjectSerializerWriteContextComplex.cs
- CaretElement.cs
- SevenBitStream.cs
- SortKey.cs
- XmlUnspecifiedAttribute.cs
- BinaryMethodMessage.cs
- TimelineGroup.cs
- HwndProxyElementProvider.cs
- RadioButtonPopupAdapter.cs
- XsdBuildProvider.cs
- AtomPub10CategoriesDocumentFormatter.cs
- ParentQuery.cs
- HttpPostedFile.cs
- DesignerToolboxInfo.cs
- ChtmlTextWriter.cs
- XPathDocumentBuilder.cs
- metadatamappinghashervisitor.cs
- TextTreeText.cs
- ElementUtil.cs
- ControlIdConverter.cs
- BrowserDefinitionCollection.cs
- TreeNodeCollection.cs
- BamlResourceSerializer.cs
- ToolBarButtonClickEvent.cs
- ParamArrayAttribute.cs
- XmlDocumentFragment.cs
- FormsAuthenticationUserCollection.cs
- DataViewSettingCollection.cs
- XmlImplementation.cs
- WebServiceErrorEvent.cs
- Point4D.cs
- MiniModule.cs
- RadioButton.cs
- baseshape.cs
- SchemaMapping.cs
- HtmlMeta.cs
- CollectionBuilder.cs
- TextChangedEventArgs.cs
- TransactionFlowElement.cs
- BinaryFormatterSinks.cs
- ValueSerializer.cs
- IPEndPoint.cs
- BitmapImage.cs
- BordersPage.cs
- Decorator.cs
- EntityObject.cs
- BitmapEffectGroup.cs
- CachedBitmap.cs
- StateManagedCollection.cs
- FormViewInsertEventArgs.cs
- TagElement.cs
- BitmapEffectDrawingContextWalker.cs
- DiagnosticStrings.cs
- FontUnitConverter.cs
- DataRow.cs
- HttpWebRequest.cs
- MetadataException.cs