Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.ServiceModel.Channels / System / ServiceModel / Channels / XmlBufferedByteStreamReader.cs / 1305376 / XmlBufferedByteStreamReader.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel.Channels { using System; using System.IO; using System.Runtime; using System.Xml; class XmlBufferedByteStreamReader : XmlByteStreamReader { ByteStreamBufferedMessageData bufferedMessageData; int offset; static byte[] emptyByteArray = new byte[0]; public XmlBufferedByteStreamReader(ByteStreamBufferedMessageData bufferedMessageData, XmlDictionaryReaderQuotas quotas) : base (quotas) { Fx.Assert(bufferedMessageData != null, "bufferedMessageData is null"); this.bufferedMessageData = bufferedMessageData; this.bufferedMessageData.Open(); this.offset = 0; this.quotas = quotas; this.position = ReaderPosition.None; } protected override void OnClose() { this.bufferedMessageData.Close(); this.bufferedMessageData = null; this.offset = 0; base.OnClose(); } public override int ReadContentAsBase64(byte[] buffer, int index, int count) { EnsureInContent(); ByteStreamMessageUtility.EnsureByteBoundaries(buffer, index, count); if (count == 0) { return 0; } int bytesToCopy = Math.Min(bufferedMessageData.Count - this.offset, count); if (bytesToCopy == 0) { this.position = ReaderPosition.EndElement; return 0; } Buffer.BlockCopy(this.bufferedMessageData.Buffer, this.offset, buffer, index, bytesToCopy); this.offset += bytesToCopy; return bytesToCopy; } public override bool TryGetBase64ContentLength(out int length) { if (!this.IsClosed) { // in ByteStream encoder, we're not concerned about individual xml nodes // therefore we can just return the entire segment of the buffer we're using in this reader. length = bufferedMessageData.Count; return true; } length = -1; return false; } } } // 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
- UnaryExpression.cs
- basevalidator.cs
- InternalDispatchObject.cs
- ScrollChrome.cs
- StrongNameIdentityPermission.cs
- IsolatedStorageFile.cs
- ScriptMethodAttribute.cs
- HebrewCalendar.cs
- SchemaCollectionPreprocessor.cs
- InvokeHandlers.cs
- _SslStream.cs
- FormatConvertedBitmap.cs
- Quaternion.cs
- SqlDataSourceConnectionPanel.cs
- BooleanExpr.cs
- NodeCounter.cs
- BamlBinaryReader.cs
- DefaultClaimSet.cs
- DictionaryBase.cs
- InternalConfigRoot.cs
- RoleManagerSection.cs
- DynamicDataExtensions.cs
- XPathScanner.cs
- ConfigurationStrings.cs
- OracleColumn.cs
- ValidatorAttribute.cs
- SynchronizedInputPattern.cs
- IntSecurity.cs
- COM2Properties.cs
- RegionInfo.cs
- PieceNameHelper.cs
- ToolStripLocationCancelEventArgs.cs
- PeerNameRecordCollection.cs
- TransactionInterop.cs
- BaseCAMarshaler.cs
- ToolStripGripRenderEventArgs.cs
- CatalogPartCollection.cs
- AlternateViewCollection.cs
- InternalControlCollection.cs
- DiscoveryInnerClientAdhoc11.cs
- LambdaCompiler.Unary.cs
- CompilerScopeManager.cs
- TableRow.cs
- RulePatternOps.cs
- ApplyHostConfigurationBehavior.cs
- ResolveNameEventArgs.cs
- CodeCompiler.cs
- GroupStyle.cs
- UpdatePanelControlTrigger.cs
- NativeMethods.cs
- UriTemplateLiteralPathSegment.cs
- DataControlImageButton.cs
- Codec.cs
- StrongNameMembershipCondition.cs
- SQLDecimalStorage.cs
- NullReferenceException.cs
- MultipartContentParser.cs
- EventSinkActivity.cs
- DeleteHelper.cs
- ModifierKeysValueSerializer.cs
- Model3D.cs
- Evidence.cs
- PerformanceCounterPermission.cs
- ResourceManager.cs
- BinaryKeyIdentifierClause.cs
- FlowDocumentPaginator.cs
- PolyLineSegmentFigureLogic.cs
- PolyLineSegment.cs
- RadioButton.cs
- TriggerAction.cs
- TransactionInformation.cs
- SafeTimerHandle.cs
- ChangeConflicts.cs
- CacheMode.cs
- TransformerInfo.cs
- EmbeddedMailObjectsCollection.cs
- FilterableAttribute.cs
- CompiledELinqQueryState.cs
- AbstractExpressions.cs
- QilName.cs
- SchemaSetCompiler.cs
- WebBrowserPermission.cs
- CDSCollectionETWBCLProvider.cs
- WmlValidatorAdapter.cs
- ArgumentOutOfRangeException.cs
- SystemInfo.cs
- NetworkCredential.cs
- CodeTypeMemberCollection.cs
- XmlSchemaDocumentation.cs
- GridViewSelectEventArgs.cs
- EventLog.cs
- ClientSideQueueItem.cs
- DelegateArgumentValue.cs
- login.cs
- XmlStrings.cs
- ObjectHandle.cs
- SettingsSavedEventArgs.cs
- MultiAsyncResult.cs
- ThreadSafeList.cs
- HijriCalendar.cs