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
- CodeTypeConstructor.cs
- ContentDesigner.cs
- PropertyGridCommands.cs
- DataBindingCollectionConverter.cs
- PartialClassGenerationTaskInternal.cs
- WindowsStatusBar.cs
- MethodCallConverter.cs
- PageContentCollection.cs
- Single.cs
- DecimalStorage.cs
- MethodImplAttribute.cs
- CornerRadius.cs
- DrawingVisual.cs
- SubpageParaClient.cs
- FixedFlowMap.cs
- ExpressionVisitorHelpers.cs
- OleStrCAMarshaler.cs
- TextEditorContextMenu.cs
- CalculatedColumn.cs
- CodePrimitiveExpression.cs
- RsaKeyIdentifierClause.cs
- SelectingProviderEventArgs.cs
- basecomparevalidator.cs
- TextRunTypographyProperties.cs
- SqlFacetAttribute.cs
- IBuiltInEvidence.cs
- _SslSessionsCache.cs
- DataGridLinkButton.cs
- StorageConditionPropertyMapping.cs
- XmlDocumentSerializer.cs
- PreservationFileWriter.cs
- EventArgs.cs
- StickyNoteAnnotations.cs
- ObjectDataSourceFilteringEventArgs.cs
- ResXResourceSet.cs
- DeobfuscatingStream.cs
- WindowInteropHelper.cs
- FixedSOMContainer.cs
- ColumnReorderedEventArgs.cs
- WmlTextViewAdapter.cs
- ExpressionValueEditor.cs
- BreakRecordTable.cs
- Transform.cs
- JsonSerializer.cs
- MarshalByRefObject.cs
- DefaultBindingPropertyAttribute.cs
- EventLogHandle.cs
- TextEditorTyping.cs
- XmlLinkedNode.cs
- InternalConfigRoot.cs
- XmlCharCheckingReader.cs
- PerformanceCounterPermissionAttribute.cs
- TextCharacters.cs
- NativeCompoundFileAPIs.cs
- AutoSizeToolBoxItem.cs
- EventRecord.cs
- LineMetrics.cs
- BindableAttribute.cs
- Setter.cs
- UpdateCompiler.cs
- SystemColors.cs
- MinimizableAttributeTypeConverter.cs
- EntityDesignPluralizationHandler.cs
- TiffBitmapDecoder.cs
- DateTimePicker.cs
- SamlAction.cs
- Win32NamedPipes.cs
- Unit.cs
- GC.cs
- BuiltInExpr.cs
- OleDbEnumerator.cs
- DragCompletedEventArgs.cs
- SecurityPermission.cs
- ConstructorExpr.cs
- Axis.cs
- TypedTableBase.cs
- TemplatedEditableDesignerRegion.cs
- ContractMapping.cs
- DocumentSequence.cs
- DeclaredTypeElementCollection.cs
- WindowsFormsHelpers.cs
- IdentityValidationException.cs
- DynamicFilterExpression.cs
- ComContractElementCollection.cs
- ListBindingConverter.cs
- Storyboard.cs
- BaseParagraph.cs
- Message.cs
- cookiecollection.cs
- IconBitmapDecoder.cs
- XslTransform.cs
- XmlEntity.cs
- TextCollapsingProperties.cs
- Vector.cs
- SystemIPGlobalStatistics.cs
- WebScriptClientGenerator.cs
- OdbcDataReader.cs
- SystemException.cs
- Preprocessor.cs
- HostUtils.cs