Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.ServiceModel.Channels / System / ServiceModel / Channels / XmlBufferedByteStreamReader.cs / 1305376 / XmlBufferedByteStreamReader.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel.Channels { using System; using System.IO; using System.Runtime; using System.Xml; class XmlBufferedByteStreamReader : XmlByteStreamReader { ByteStreamBufferedMessageData bufferedMessageData; int offset; static byte[] emptyByteArray = new byte[0]; public XmlBufferedByteStreamReader(ByteStreamBufferedMessageData bufferedMessageData, XmlDictionaryReaderQuotas quotas) : base (quotas) { Fx.Assert(bufferedMessageData != null, "bufferedMessageData is null"); this.bufferedMessageData = bufferedMessageData; this.bufferedMessageData.Open(); this.offset = 0; this.quotas = quotas; this.position = ReaderPosition.None; } protected override void OnClose() { this.bufferedMessageData.Close(); this.bufferedMessageData = null; this.offset = 0; base.OnClose(); } public override int ReadContentAsBase64(byte[] buffer, int index, int count) { EnsureInContent(); ByteStreamMessageUtility.EnsureByteBoundaries(buffer, index, count); if (count == 0) { return 0; } int bytesToCopy = Math.Min(bufferedMessageData.Count - this.offset, count); if (bytesToCopy == 0) { this.position = ReaderPosition.EndElement; return 0; } Buffer.BlockCopy(this.bufferedMessageData.Buffer, this.offset, buffer, index, bytesToCopy); this.offset += bytesToCopy; return bytesToCopy; } public override bool TryGetBase64ContentLength(out int length) { if (!this.IsClosed) { // in ByteStream encoder, we're not concerned about individual xml nodes // therefore we can just return the entire segment of the buffer we're using in this reader. length = bufferedMessageData.Count; return true; } length = -1; return false; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SelectingProviderEventArgs.cs
- ObjectResult.cs
- RemotingConfigParser.cs
- TimeoutStream.cs
- SignatureResourcePool.cs
- UnicastIPAddressInformationCollection.cs
- ContextStack.cs
- PrimaryKeyTypeConverter.cs
- HashMembershipCondition.cs
- OptimalTextSource.cs
- MailAddressCollection.cs
- PreloadedPackages.cs
- HtmlInputCheckBox.cs
- OperationInfoBase.cs
- Part.cs
- WebSysDefaultValueAttribute.cs
- LogRestartAreaEnumerator.cs
- GridEntry.cs
- MetadataSource.cs
- DocumentGridContextMenu.cs
- NativeCppClassAttribute.cs
- EventLog.cs
- PaginationProgressEventArgs.cs
- ContainerUIElement3D.cs
- MsmqBindingMonitor.cs
- DataGridViewCellValueEventArgs.cs
- MarkerProperties.cs
- BitmapPalettes.cs
- Context.cs
- MessagePropertyFilter.cs
- DeferredElementTreeState.cs
- UnsafeNativeMethods.cs
- _NativeSSPI.cs
- ImportCatalogPart.cs
- ResourceDescriptionAttribute.cs
- ArrayTypeMismatchException.cs
- FormClosingEvent.cs
- ReflectionTypeLoadException.cs
- MetadataConversionError.cs
- SiteMembershipCondition.cs
- XPathException.cs
- TypeCodeDomSerializer.cs
- BooleanSwitch.cs
- MatchingStyle.cs
- SqlDataRecord.cs
- TrustLevelCollection.cs
- CollectionBase.cs
- RadioButton.cs
- SimpleHandlerFactory.cs
- WindowsListViewSubItem.cs
- SchemaTableColumn.cs
- FrameworkPropertyMetadata.cs
- RuntimeConfig.cs
- TransformPattern.cs
- Blend.cs
- thaishape.cs
- FileLogRecordHeader.cs
- ExtendedPropertiesHandler.cs
- Rights.cs
- Graphics.cs
- DoubleAnimationBase.cs
- FullTextState.cs
- Buffer.cs
- CodeRemoveEventStatement.cs
- ProfileBuildProvider.cs
- TextRange.cs
- FileController.cs
- SmtpMail.cs
- EqualityComparer.cs
- BinaryObjectInfo.cs
- AvTrace.cs
- NumberAction.cs
- DesignColumnCollection.cs
- ValueType.cs
- HebrewCalendar.cs
- RelOps.cs
- TransformCryptoHandle.cs
- HtmlButton.cs
- ISAPIApplicationHost.cs
- SHA512.cs
- WinInetCache.cs
- WindowsIPAddress.cs
- CollectionsUtil.cs
- ConfigXmlWhitespace.cs
- StrongNameHelpers.cs
- FixedBufferAttribute.cs
- NameTable.cs
- SQLStringStorage.cs
- ReadOnlyCollection.cs
- PageAsyncTask.cs
- UpdatePanelTrigger.cs
- PhysicalFontFamily.cs
- TimeSpanFormat.cs
- ControlBuilder.cs
- BuilderPropertyEntry.cs
- XmlAttributes.cs
- StorageEndPropertyMapping.cs
- GridEntryCollection.cs
- UpdateExpressionVisitor.cs
- RenderingBiasValidation.cs