Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataWeb / Server / System / Data / Services / Serializers / BinarySerializer.cs / 1305376 / BinarySerializer.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // //// Provides a serializer for binary content. // // // @owner [....] //--------------------------------------------------------------------- namespace System.Data.Services.Serializers { using System.Diagnostics; using System.IO; using System.Xml; ///Provides support for serializing responses in binary format. ////// The file histroy should show a BinaryExceptionTextWriter which is no longer used. /// internal struct BinarySerializer : IExceptionWriter { ///Stream to which output is sent. private readonly Stream outputStream; ///Initializes a new /// Stream to which output should be sent. internal BinarySerializer(Stream output) { Debug.Assert(output != null, "output != null"); this.outputStream = output; } ///for the specified stream. Serializes exception information. /// Description of exception to serialize. public void WriteException(HandleExceptionArgs args) { Debug.Assert(args != null, "args != null"); XmlWriter xmlWriter = XmlWriter.Create(this.outputStream); ErrorHandler.SerializeXmlError(args, xmlWriter); xmlWriter.Flush(); } ///Handles the complete serialization for the specified content. /// Single Content to write.. ///internal void WriteRequest(object content) { Debug.Assert(content != null, "content != null"); // The metadata layer should only accept byte arrays as binary-serialized values. byte[] bytes; if (content is byte[]) { bytes = (byte[])content; } else { bytes = (byte[])((System.Data.Linq.Binary)content).ToArray(); } this.outputStream.Write(bytes, 0, bytes.Length); } /// should be a byte array. Handles the complete serialization for the specified stream. /// Input stream to write out. /// Buffer size to use during copying. internal void WriteRequest(Stream inputStream, int bufferSize) { Debug.Assert(inputStream != null, "stream != null"); WebUtil.CopyStream(inputStream, this.outputStream, bufferSize); } } } // 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
- SetterBaseCollection.cs
- CheckBox.cs
- ObjectPersistData.cs
- XAMLParseException.cs
- ScriptingJsonSerializationSection.cs
- ScriptingAuthenticationServiceSection.cs
- XamlGridLengthSerializer.cs
- SynchronizingStream.cs
- AssemblyNameUtility.cs
- CharEntityEncoderFallback.cs
- SerializationAttributes.cs
- SizeAnimationUsingKeyFrames.cs
- _RequestLifetimeSetter.cs
- TileModeValidation.cs
- RegexBoyerMoore.cs
- WindowsSolidBrush.cs
- ViewCellRelation.cs
- AbsoluteQuery.cs
- EventData.cs
- GenericRootAutomationPeer.cs
- _NtlmClient.cs
- TimeStampChecker.cs
- XmlValidatingReader.cs
- tooltip.cs
- Int32AnimationUsingKeyFrames.cs
- DataGridBoolColumn.cs
- SmtpException.cs
- SafeProcessHandle.cs
- Light.cs
- TrustLevelCollection.cs
- ObjectItemConventionAssemblyLoader.cs
- DesigntimeLicenseContextSerializer.cs
- TypeDelegator.cs
- RelOps.cs
- embossbitmapeffect.cs
- CrossContextChannel.cs
- NegotiationTokenAuthenticator.cs
- WindowsRichEditRange.cs
- PathTooLongException.cs
- HashCodeCombiner.cs
- GradientBrush.cs
- NamedServiceModelExtensionCollectionElement.cs
- ChildTable.cs
- OutKeywords.cs
- CustomTokenProvider.cs
- AccessibleObject.cs
- SchemaConstraints.cs
- SqlDataSourceDesigner.cs
- ProfileManager.cs
- FontWeight.cs
- ContravarianceAdapter.cs
- _KerberosClient.cs
- ArcSegment.cs
- ColorContext.cs
- WSFederationHttpSecurityMode.cs
- DetailsViewPageEventArgs.cs
- ConcurrencyBehavior.cs
- SkipStoryboardToFill.cs
- _AuthenticationState.cs
- SqlFacetAttribute.cs
- indexingfiltermarshaler.cs
- TouchesOverProperty.cs
- NetNamedPipeBindingCollectionElement.cs
- SoapParser.cs
- ModelItemDictionary.cs
- RoleManagerModule.cs
- CachedBitmap.cs
- DatatypeImplementation.cs
- ListViewSelectEventArgs.cs
- ContextStaticAttribute.cs
- Currency.cs
- ListViewSelectEventArgs.cs
- _TransmitFileOverlappedAsyncResult.cs
- RoleGroup.cs
- IFlowDocumentViewer.cs
- RelationshipSet.cs
- IndexedString.cs
- ThemeDirectoryCompiler.cs
- TextLineResult.cs
- StatusBarDrawItemEvent.cs
- TextElement.cs
- TablePattern.cs
- Input.cs
- ConnectionAcceptor.cs
- Decorator.cs
- ISFClipboardData.cs
- GridProviderWrapper.cs
- MsdtcWrapper.cs
- ModelVisual3D.cs
- GradientBrush.cs
- ActivityBuilderHelper.cs
- CharacterMetrics.cs
- ping.cs
- StaticExtension.cs
- ItemCollection.cs
- GetLastErrorDetailsRequest.cs
- CmsInterop.cs
- TextServicesManager.cs
- EntityDataSourceContainerNameItem.cs
- ServiceChannel.cs