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
- OleDbException.cs
- FileDialogCustomPlace.cs
- XmlReflectionImporter.cs
- DetailsViewInsertedEventArgs.cs
- Screen.cs
- FilterInvalidBodyAccessException.cs
- Propagator.Evaluator.cs
- SequenceDesignerAccessibleObject.cs
- Win32Interop.cs
- FileUtil.cs
- VectorCollection.cs
- Int32CollectionValueSerializer.cs
- ToolStripItemImageRenderEventArgs.cs
- handlecollector.cs
- Overlapped.cs
- ResourceDescriptionAttribute.cs
- SchemaObjectWriter.cs
- SQLGuid.cs
- Memoizer.cs
- RowToParametersTransformer.cs
- StickyNote.cs
- Wizard.cs
- HostSecurityManager.cs
- DataTableReader.cs
- PlainXmlSerializer.cs
- XamlSerializationHelper.cs
- TransformGroup.cs
- Function.cs
- WindowsStartMenu.cs
- MeasureData.cs
- PropertySegmentSerializationProvider.cs
- TreeViewHitTestInfo.cs
- ByteStream.cs
- NativeMethods.cs
- BoundsDrawingContextWalker.cs
- PasswordDeriveBytes.cs
- DbDataRecord.cs
- DBCommand.cs
- dtdvalidator.cs
- httpapplicationstate.cs
- CompoundFileReference.cs
- COM2PictureConverter.cs
- AnnotationResourceCollection.cs
- FieldDescriptor.cs
- RequestUriProcessor.cs
- COM2IPerPropertyBrowsingHandler.cs
- CharacterBufferReference.cs
- ErrorHandler.cs
- WebPartConnectionsConfigureVerb.cs
- EditorServiceContext.cs
- PerformanceCounterCategory.cs
- ProgressBarHighlightConverter.cs
- RectangleConverter.cs
- entitydatasourceentitysetnameconverter.cs
- WindowsListViewGroupHelper.cs
- Int16Converter.cs
- TransactionFormatter.cs
- DependencyObjectType.cs
- AutoResetEvent.cs
- DataPointer.cs
- TextInfo.cs
- CqlQuery.cs
- ListBox.cs
- _Events.cs
- SingleStorage.cs
- shaper.cs
- GC.cs
- LeaseManager.cs
- SimpleType.cs
- UnsafePeerToPeerMethods.cs
- DataListCommandEventArgs.cs
- TcpProcessProtocolHandler.cs
- Section.cs
- Fonts.cs
- ReachIDocumentPaginatorSerializer.cs
- IChannel.cs
- SRDisplayNameAttribute.cs
- DataGridViewTextBoxCell.cs
- PointUtil.cs
- SliderAutomationPeer.cs
- Size3D.cs
- IdentitySection.cs
- BitmapEffect.cs
- TransformProviderWrapper.cs
- QuadraticBezierSegment.cs
- TextDpi.cs
- TableAdapterManagerMethodGenerator.cs
- GCHandleCookieTable.cs
- WrappedKeySecurityToken.cs
- SiteOfOriginContainer.cs
- DocumentPageTextView.cs
- ObjectNotFoundException.cs
- ConditionalExpression.cs
- PropertyRecord.cs
- LocatorPartList.cs
- Script.cs
- VarInfo.cs
- TimelineCollection.cs
- EntityDataSourceDataSelectionPanel.cs
- ResourcePermissionBaseEntry.cs