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
- COAUTHIDENTITY.cs
- Wizard.cs
- DataGridViewSelectedCellCollection.cs
- SystemIcmpV6Statistics.cs
- TokenBasedSetEnumerator.cs
- BinHexEncoding.cs
- SchemaImporterExtensionElementCollection.cs
- AspProxy.cs
- ISAPIRuntime.cs
- AnnouncementInnerClientCD1.cs
- RoutedEvent.cs
- DrawItemEvent.cs
- JsonClassDataContract.cs
- XmlReturnWriter.cs
- KoreanCalendar.cs
- MobileUserControl.cs
- listviewsubitemcollectioneditor.cs
- AmbientLight.cs
- Partitioner.cs
- ChannelCacheSettings.cs
- BaseDataBoundControl.cs
- SystemIcmpV4Statistics.cs
- UntrustedRecipientException.cs
- TextBoxDesigner.cs
- GridViewActionList.cs
- HttpWebRequest.cs
- ListParagraph.cs
- SchemaAttDef.cs
- WebPageTraceListener.cs
- KeyConverter.cs
- HwndSource.cs
- RefreshPropertiesAttribute.cs
- InvalidComObjectException.cs
- OdbcConnectionOpen.cs
- WebBrowsableAttribute.cs
- BamlLocalizer.cs
- AccessDataSource.cs
- Marshal.cs
- FileSystemInfo.cs
- Condition.cs
- ManagedWndProcTracker.cs
- EditorZone.cs
- ExtensionSimplifierMarkupObject.cs
- XmlNodeComparer.cs
- DataTableExtensions.cs
- Composition.cs
- VerticalAlignConverter.cs
- BindingElementExtensionElement.cs
- SafeEventLogWriteHandle.cs
- CriticalExceptions.cs
- relpropertyhelper.cs
- SystemWebCachingSectionGroup.cs
- SerializationException.cs
- DataControlPagerLinkButton.cs
- ExternalCalls.cs
- IsolatedStorageSecurityState.cs
- SimplePropertyEntry.cs
- SaveFileDialog.cs
- XsdValidatingReader.cs
- IISUnsafeMethods.cs
- FrameworkElement.cs
- AtomPub10CategoriesDocumentFormatter.cs
- RadioButtonRenderer.cs
- HtmlMeta.cs
- BitStack.cs
- Menu.cs
- TypedTableBaseExtensions.cs
- IdentityManager.cs
- ConfigXmlAttribute.cs
- WindowsEditBoxRange.cs
- FontInfo.cs
- VerificationException.cs
- SmtpNetworkElement.cs
- DataGridColumnHeadersPresenter.cs
- DefaultHttpHandler.cs
- MenuItemBinding.cs
- Rect3DConverter.cs
- MenuItemStyle.cs
- ReferentialConstraint.cs
- BuildManager.cs
- _SafeNetHandles.cs
- ContentElement.cs
- AssertSection.cs
- AuthenticationSection.cs
- PropertySourceInfo.cs
- AppDomainAttributes.cs
- WindowsTitleBar.cs
- PrimaryKeyTypeConverter.cs
- MembershipPasswordException.cs
- EdmComplexTypeAttribute.cs
- XsdBuilder.cs
- ResourceExpression.cs
- UnsafeNativeMethods.cs
- ValidateNames.cs
- ExportException.cs
- wgx_sdk_version.cs
- ReceiveMessageRecord.cs
- EventItfInfo.cs
- OuterGlowBitmapEffect.cs
- AnonymousIdentificationSection.cs