Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Xml / System / Xml / Core / IncrementalReadDecoders.cs / 1305376 / 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(); } #if !SILVERLIGHT // Needed only for XmlTextReader // // 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; } } #endif } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Identity.cs
- LineUtil.cs
- Request.cs
- ScriptingJsonSerializationSection.cs
- NodeInfo.cs
- IdentityValidationException.cs
- ArraySegment.cs
- XmlException.cs
- ExpressionStringBuilder.cs
- DbCommandTree.cs
- EdmComplexPropertyAttribute.cs
- DataGridLinkButton.cs
- TimeStampChecker.cs
- DataSourceSelectArguments.cs
- XmlSchema.cs
- DoubleIndependentAnimationStorage.cs
- DbConnectionClosed.cs
- SemanticBasicElement.cs
- HWStack.cs
- XPathDocumentIterator.cs
- BuildProvider.cs
- MappingSource.cs
- SqlNodeAnnotation.cs
- ProjectedWrapper.cs
- UIAgentAsyncBeginRequest.cs
- TouchFrameEventArgs.cs
- PriorityBindingExpression.cs
- EnvelopedSignatureTransform.cs
- RuntimeHandles.cs
- StateManagedCollection.cs
- AnimationException.cs
- SqlCacheDependency.cs
- PersonalizationProviderHelper.cs
- CreatingCookieEventArgs.cs
- OracleException.cs
- PassportAuthentication.cs
- Substitution.cs
- UnsafeMethods.cs
- ExpandoObject.cs
- Debug.cs
- XPathCompileException.cs
- HyperLinkColumn.cs
- Keywords.cs
- BamlResourceContent.cs
- HuffCodec.cs
- WindowsTab.cs
- DiagnosticsConfiguration.cs
- CompilerState.cs
- FormatterConverter.cs
- PolicyLevel.cs
- PathSegmentCollection.cs
- StaticSiteMapProvider.cs
- ListViewItemMouseHoverEvent.cs
- DataGridView.cs
- Models.cs
- Permission.cs
- ProviderUtil.cs
- ChannelManager.cs
- ObjectContext.cs
- PropertyOverridesDialog.cs
- PeerCollaborationPermission.cs
- XDRSchema.cs
- ExtendedPropertyDescriptor.cs
- OdbcCommandBuilder.cs
- ListBindableAttribute.cs
- CodeCatchClause.cs
- RepeaterItemEventArgs.cs
- ConvertEvent.cs
- DataTransferEventArgs.cs
- DataGridCommandEventArgs.cs
- EditorPartChrome.cs
- SecurityContext.cs
- ConnectionPointGlyph.cs
- MaterialGroup.cs
- WebBaseEventKeyComparer.cs
- BoolExpr.cs
- TimelineClockCollection.cs
- MetadataCollection.cs
- DoWorkEventArgs.cs
- XmlUtf8RawTextWriter.cs
- DocumentViewerHelper.cs
- CryptoApi.cs
- InputScopeNameConverter.cs
- WorkflowApplicationUnloadedException.cs
- ProviderIncompatibleException.cs
- WebBrowserProgressChangedEventHandler.cs
- ViewSimplifier.cs
- SecurityContextSecurityTokenResolver.cs
- MeshGeometry3D.cs
- ClearCollection.cs
- OlePropertyStructs.cs
- SourceFileBuildProvider.cs
- XmlSchemaAnnotation.cs
- StaticSiteMapProvider.cs
- ToolTip.cs
- ExpressionPrinter.cs
- StreamingContext.cs
- InputEventArgs.cs
- AuthenticationModulesSection.cs
- VerticalAlignConverter.cs