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
- SqlProfileProvider.cs
- TimeSpanMinutesConverter.cs
- SqlServer2KCompatibilityCheck.cs
- Substitution.cs
- XmlTypeMapping.cs
- LocalServiceSecuritySettingsElement.cs
- AccessDataSource.cs
- AttributeCollection.cs
- HierarchicalDataBoundControlAdapter.cs
- DataGridViewTopLeftHeaderCell.cs
- RoleManagerSection.cs
- DataObjectEventArgs.cs
- VisualBrush.cs
- URLAttribute.cs
- ReferencedAssembly.cs
- _ProxyChain.cs
- XmlElement.cs
- ProviderCommandInfoUtils.cs
- EditorAttributeInfo.cs
- ButtonChrome.cs
- XmlSerializerAssemblyAttribute.cs
- COM2EnumConverter.cs
- MonthCalendar.cs
- CqlLexerHelpers.cs
- LineBreak.cs
- ConnectionPoint.cs
- CalendarItem.cs
- ScrollChrome.cs
- ToolZoneDesigner.cs
- UIElement.cs
- SurrogateEncoder.cs
- HelpKeywordAttribute.cs
- CustomAttributeSerializer.cs
- XmlProcessingInstruction.cs
- UnmanagedMemoryStream.cs
- WebPartsPersonalization.cs
- OledbConnectionStringbuilder.cs
- BrushValueSerializer.cs
- Queue.cs
- ProxyWebPartManager.cs
- DescriptionAttribute.cs
- ComponentGlyph.cs
- Span.cs
- StdValidatorsAndConverters.cs
- ComboBox.cs
- DictionaryKeyPropertyAttribute.cs
- CacheEntry.cs
- Stacktrace.cs
- ColorMap.cs
- UserControlDesigner.cs
- TiffBitmapEncoder.cs
- DataPointer.cs
- UnsafeNativeMethodsCLR.cs
- SafeTimerHandle.cs
- EncoderExceptionFallback.cs
- AnimatedTypeHelpers.cs
- CFStream.cs
- UIntPtr.cs
- XmlChildEnumerator.cs
- SchemaMerger.cs
- PackagePart.cs
- PropertyItemInternal.cs
- HttpApplicationFactory.cs
- ListManagerBindingsCollection.cs
- TextDpi.cs
- EdmConstants.cs
- ContravarianceAdapter.cs
- HttpCacheVary.cs
- HttpEncoderUtility.cs
- ReceiveSecurityHeaderElementManager.cs
- PersonalizationStateInfoCollection.cs
- FragmentNavigationEventArgs.cs
- CodeObject.cs
- dbdatarecord.cs
- DataControlLinkButton.cs
- SystemIPv4InterfaceProperties.cs
- PriorityQueue.cs
- SqlMethodCallConverter.cs
- WebControlsSection.cs
- SafeFileMapViewHandle.cs
- WorkflowValidationFailedException.cs
- ScrollItemPatternIdentifiers.cs
- WindowsFormsSectionHandler.cs
- StatusBar.cs
- ByteFacetDescriptionElement.cs
- PixelShader.cs
- DBBindings.cs
- XmlUtil.cs
- ListParaClient.cs
- PersistenceMetadataNamespace.cs
- CompoundFileReference.cs
- RecognizedWordUnit.cs
- TableLayoutPanelCellPosition.cs
- AsnEncodedData.cs
- SoapEnumAttribute.cs
- FilteredAttributeCollection.cs
- FtpRequestCacheValidator.cs
- AffineTransform3D.cs
- PagePropertiesChangingEventArgs.cs
- FixedSOMElement.cs