Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.ServiceModel.Channels / System / ServiceModel / Channels / XmlStreamedByteStreamReader.cs / 1305376 / XmlStreamedByteStreamReader.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel.Channels { using System; using System.IO; using System.Runtime; using System.Xml; class XmlStreamedByteStreamReader : XmlByteStreamReader { Stream stream; public XmlStreamedByteStreamReader(Stream stream, XmlDictionaryReaderQuotas quotas) : base(quotas) { Fx.Assert(stream != null, "stream is null"); this.stream = stream; } protected override void OnClose() { if (this.stream != null) { this.stream.Close(); } this.stream = null; base.OnClose(); } public override int ReadContentAsBase64(byte[] buffer, int index, int count) { EnsureInContent(); ByteStreamMessageUtility.EnsureByteBoundaries(buffer, index, count); if (count == 0) { return 0; } int numBytesRead = stream.Read(buffer, index, count); if (numBytesRead == 0) { this.position = ReaderPosition.EndElement; } return numBytesRead; } public override bool TryGetBase64ContentLength(out int length) { // in ByteStream encoder, we're not concerned about individual xml nodes // therefore we can just return the entire length of the stream if (!this.IsClosed && this.stream.CanSeek) { long streamLength = this.stream.Length; if (streamLength <= int.MaxValue) { length = (int)streamLength; 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
- DBSqlParserColumn.cs
- SafePointer.cs
- BitmapEffectrendercontext.cs
- TypeConstant.cs
- FlatButtonAppearance.cs
- Point4D.cs
- HeaderCollection.cs
- TableRowCollection.cs
- DataGridRowEventArgs.cs
- UserControl.cs
- HeaderUtility.cs
- PropertyMetadata.cs
- Hash.cs
- Math.cs
- XmlDownloadManager.cs
- XmlNodeComparer.cs
- PointConverter.cs
- BindValidationContext.cs
- ListDesigner.cs
- DataBindingCollection.cs
- ExtendedProtectionPolicyElement.cs
- _HeaderInfoTable.cs
- CatalogZone.cs
- TreeNodeConverter.cs
- StreamingContext.cs
- ThreadPoolTaskScheduler.cs
- FixedFlowMap.cs
- BufferedGraphics.cs
- StackSpiller.cs
- DocumentGridPage.cs
- xdrvalidator.cs
- ConstrainedDataObject.cs
- CachedFontFamily.cs
- SubMenuStyle.cs
- TablePatternIdentifiers.cs
- ScriptManager.cs
- CopyAction.cs
- SqlCacheDependencyDatabaseCollection.cs
- MethodBuilder.cs
- XmlNode.cs
- EntityDataSourceDataSelection.cs
- CodeMemberField.cs
- MemberPath.cs
- XPathArrayIterator.cs
- SizeKeyFrameCollection.cs
- ProfileManager.cs
- MenuItemStyle.cs
- UriSectionData.cs
- BaseResourcesBuildProvider.cs
- AutomationAttributeInfo.cs
- WeakRefEnumerator.cs
- DesignerAdapterUtil.cs
- ParseChildrenAsPropertiesAttribute.cs
- SetterBaseCollection.cs
- WebBrowserDocumentCompletedEventHandler.cs
- PartDesigner.cs
- PermissionToken.cs
- ObjectParameter.cs
- DBAsyncResult.cs
- BitmapEffect.cs
- IIS7WorkerRequest.cs
- GroupDescription.cs
- TextOnlyOutput.cs
- ZipIOLocalFileHeader.cs
- XmlSchemaCollection.cs
- ListCollectionView.cs
- Missing.cs
- Control.cs
- LayoutEvent.cs
- DashStyles.cs
- DependencySource.cs
- _NetworkingPerfCounters.cs
- DrawingGroupDrawingContext.cs
- CollectionBase.cs
- Size.cs
- ConnectionManagementSection.cs
- WindowsListViewGroupHelper.cs
- ListBindingConverter.cs
- QuaternionAnimation.cs
- X509ChainElement.cs
- CheckPair.cs
- SingleQueryOperator.cs
- ReadOnlyPropertyMetadata.cs
- RealProxy.cs
- ToolTipAutomationPeer.cs
- AppearanceEditorPart.cs
- Page.cs
- DataGridViewRowConverter.cs
- HttpResponseBase.cs
- PropertyGeneratedEventArgs.cs
- AutomationElementCollection.cs
- CryptoHandle.cs
- PlanCompiler.cs
- SubpageParaClient.cs
- HttpRawResponse.cs
- WorkflowInstanceTerminatedRecord.cs
- Matrix3DConverter.cs
- HttpDictionary.cs
- NativeBuffer.cs
- SafeMarshalContext.cs