Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / ndp / fx / src / DataWeb / Server / System / Data / Services / Serializers / BinarySerializer.cs / 1 / BinarySerializer.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // //// Provides a serializer for binary content. // // // @owner [....] //--------------------------------------------------------------------- namespace System.Data.Services.Serializers { using System; using System.Diagnostics; using System.IO; using System.Text; 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); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------------- // should be a byte array. // Copyright (c) Microsoft Corporation. All rights reserved. // //// Provides a serializer for binary content. // // // @owner [....] //--------------------------------------------------------------------- namespace System.Data.Services.Serializers { using System; using System.Diagnostics; using System.IO; using System.Text; 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); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. should be a byte array.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TemplateControlCodeDomTreeGenerator.cs
- DocumentsTrace.cs
- FrameworkEventSource.cs
- ResourcePool.cs
- ObjectView.cs
- KeySpline.cs
- ModelItemImpl.cs
- WindowInteropHelper.cs
- TextFormatterImp.cs
- Aes.cs
- StringConcat.cs
- FigureHelper.cs
- ConnectionPoolManager.cs
- WSDualHttpSecurityMode.cs
- ControlFilterExpression.cs
- RC2.cs
- messageonlyhwndwrapper.cs
- EnumValidator.cs
- ComboBoxItem.cs
- sqlstateclientmanager.cs
- hwndwrapper.cs
- SqlParameter.cs
- SqlError.cs
- SelectionProviderWrapper.cs
- ListBoxItem.cs
- ExpressionPrefixAttribute.cs
- UrlPropertyAttribute.cs
- CallContext.cs
- GridViewHeaderRowPresenterAutomationPeer.cs
- FormsAuthenticationTicket.cs
- SQLMoneyStorage.cs
- ThreadAttributes.cs
- AttributeUsageAttribute.cs
- DataGridColumnCollectionEditor.cs
- Page.cs
- MetadataFile.cs
- ByeMessageApril2005.cs
- KnownTypesHelper.cs
- AlternateViewCollection.cs
- CodeCommentStatement.cs
- NamedPermissionSet.cs
- UniqueIdentifierService.cs
- NonVisualControlAttribute.cs
- VirtualDirectoryMappingCollection.cs
- Int32AnimationBase.cs
- IODescriptionAttribute.cs
- SqlFactory.cs
- TrackingCondition.cs
- ContextBase.cs
- PersonalizableTypeEntry.cs
- BulletChrome.cs
- QueueProcessor.cs
- DispatchRuntime.cs
- CheckedPointers.cs
- ConfigXmlSignificantWhitespace.cs
- peersecuritysettings.cs
- ReferenceSchema.cs
- SmtpTransport.cs
- PipeStream.cs
- QueryParameter.cs
- Funcletizer.cs
- IHttpResponseInternal.cs
- AuthenticationService.cs
- PolyBezierSegment.cs
- ProxyWebPartManager.cs
- XmlDownloadManager.cs
- ForceCopyBuildProvider.cs
- UIElementCollection.cs
- GeneratedView.cs
- DataBindingHandlerAttribute.cs
- WSSecurityJan2004.cs
- DirectionalLight.cs
- TableRowGroup.cs
- VisualBrush.cs
- TokenizerHelper.cs
- FtpWebResponse.cs
- SerialPinChanges.cs
- DataError.cs
- CompositeControl.cs
- DrawListViewItemEventArgs.cs
- DataGridViewHitTestInfo.cs
- SerTrace.cs
- DelimitedListTraceListener.cs
- ScrollBar.cs
- ListViewHitTestInfo.cs
- Stack.cs
- TabPanel.cs
- QilStrConcat.cs
- HtmlContainerControl.cs
- MeasureItemEvent.cs
- Configuration.cs
- WebPartConnectionsEventArgs.cs
- MessageQueueInstaller.cs
- WebPartCancelEventArgs.cs
- ObjectDataSourceMethodEditor.cs
- ToolStripButton.cs
- DetailsViewInsertedEventArgs.cs
- BaseValidator.cs
- Debug.cs
- MachineSettingsSection.cs