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
- WebSysDefaultValueAttribute.cs
- ExpressionList.cs
- EndpointNotFoundException.cs
- XamlWriter.cs
- JoinSymbol.cs
- StylusDownEventArgs.cs
- BlurEffect.cs
- TemplateBindingExtensionConverter.cs
- MimeTypePropertyAttribute.cs
- WebPartChrome.cs
- ProxyElement.cs
- OdbcStatementHandle.cs
- XmlDictionaryWriter.cs
- SingleAnimation.cs
- KeyGestureValueSerializer.cs
- CompoundFileStorageReference.cs
- HttpCacheVary.cs
- PerformanceCounterManager.cs
- UserControlBuildProvider.cs
- CodeGotoStatement.cs
- Wildcard.cs
- TextEditorTyping.cs
- GenerateTemporaryTargetAssembly.cs
- HttpContextServiceHost.cs
- Select.cs
- WsdlParser.cs
- LookupTables.cs
- CollectionEditVerbManager.cs
- HandledMouseEvent.cs
- WebZone.cs
- WindowsListBox.cs
- KeyInfo.cs
- JsonDeserializer.cs
- PathFigure.cs
- AssemblyGen.cs
- AssociationSetMetadata.cs
- XmlNodeChangedEventManager.cs
- SyndicationSerializer.cs
- OptionUsage.cs
- Stroke.cs
- MappingException.cs
- nulltextnavigator.cs
- CellPartitioner.cs
- ParallelDesigner.cs
- CollectionEditor.cs
- DesignerCategoryAttribute.cs
- CodeGenHelper.cs
- ClientScriptManager.cs
- MultipleCopiesCollection.cs
- SynchronizationContext.cs
- CompiledQueryCacheKey.cs
- UnionExpr.cs
- DataColumn.cs
- WindowsAuthenticationEventArgs.cs
- SchemaElementDecl.cs
- D3DImage.cs
- SoapAttributeOverrides.cs
- BridgeDataRecord.cs
- GeneralTransform3DTo2DTo3D.cs
- CancellableEnumerable.cs
- WebBrowserHelper.cs
- DataTemplateSelector.cs
- DurableInstance.cs
- StorageFunctionMapping.cs
- CheckedPointers.cs
- ResXResourceReader.cs
- diagnosticsswitches.cs
- GridItemPattern.cs
- FactoryGenerator.cs
- PermissionAttributes.cs
- DependencySource.cs
- ResourceContainer.cs
- WindowsRichEdit.cs
- InvalidWMPVersionException.cs
- ZipIOLocalFileBlock.cs
- ColorIndependentAnimationStorage.cs
- WebPartDesigner.cs
- WindowsSolidBrush.cs
- JsonDeserializer.cs
- NodeInfo.cs
- Content.cs
- BooleanConverter.cs
- StateMachineSubscriptionManager.cs
- SecurityPolicyVersion.cs
- XmlRawWriterWrapper.cs
- SettingsAttributes.cs
- AnonymousIdentificationModule.cs
- MissingFieldException.cs
- Win32KeyboardDevice.cs
- GlyphRunDrawing.cs
- ShapingWorkspace.cs
- ImageIndexConverter.cs
- EditorServiceContext.cs
- CodeConstructor.cs
- HttpHandlersInstallComponent.cs
- ChannelServices.cs
- PerformanceCounterPermissionEntry.cs
- Validator.cs
- ListSortDescriptionCollection.cs
- IndexerNameAttribute.cs