Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- MergeFilterQuery.cs
- BindableAttribute.cs
- WebException.cs
- TabItemAutomationPeer.cs
- Parameter.cs
- DrawingContext.cs
- RemotingSurrogateSelector.cs
- XmlRootAttribute.cs
- ConfigurationManagerInternalFactory.cs
- ConfigXmlComment.cs
- IIS7UserPrincipal.cs
- MsmqIntegrationProcessProtocolHandler.cs
- WrappingXamlSchemaContext.cs
- TaskSchedulerException.cs
- XmlEncodedRawTextWriter.cs
- CatalogZoneAutoFormat.cs
- ColumnMap.cs
- UnsafeNativeMethodsPenimc.cs
- EndpointDispatcherTable.cs
- PreloadedPackages.cs
- SelectionWordBreaker.cs
- RectIndependentAnimationStorage.cs
- nulltextcontainer.cs
- UIElement.cs
- ServicePointManager.cs
- XamlReader.cs
- DbException.cs
- BooleanStorage.cs
- MultipartContentParser.cs
- streamingZipPartStream.cs
- ControlBuilderAttribute.cs
- MessageBox.cs
- DataGridView.cs
- SchemaImporter.cs
- SingleSelectRootGridEntry.cs
- UnaryExpressionHelper.cs
- BlobPersonalizationState.cs
- XmlSchemaComplexContentRestriction.cs
- EntitySqlQueryCacheKey.cs
- BmpBitmapDecoder.cs
- PathFigureCollectionConverter.cs
- RectAnimation.cs
- ChooseAction.cs
- XmlSerializerImportOptions.cs
- NullableConverter.cs
- Button.cs
- CookieHandler.cs
- UpWmlMobileTextWriter.cs
- TreeNodeCollection.cs
- BinaryConverter.cs
- DesignerValidationSummaryAdapter.cs
- FormConverter.cs
- IDReferencePropertyAttribute.cs
- SpecularMaterial.cs
- MD5CryptoServiceProvider.cs
- EdmProviderManifest.cs
- PartialTrustHelpers.cs
- WinEventTracker.cs
- TraceRecords.cs
- figurelength.cs
- ParenthesizePropertyNameAttribute.cs
- ToolStripContainer.cs
- StringWriter.cs
- HttpsHostedTransportConfiguration.cs
- XPathDocumentNavigator.cs
- StateMachine.cs
- MetaModel.cs
- CompilerGlobalScopeAttribute.cs
- ZipFileInfo.cs
- PDBReader.cs
- NotificationContext.cs
- DashStyles.cs
- FlowThrottle.cs
- Model3D.cs
- ExtensionQuery.cs
- WebPartDisplayModeEventArgs.cs
- TraceContext.cs
- GeometryCollection.cs
- TemplateBamlRecordReader.cs
- Button.cs
- WasAdminWrapper.cs
- HttpPostLocalhostServerProtocol.cs
- OperandQuery.cs
- ContentElementAutomationPeer.cs
- XmlSchemaFacet.cs
- CustomTypeDescriptor.cs
- AdornerDecorator.cs
- PageClientProxyGenerator.cs
- UpDownBase.cs
- NamespaceListProperty.cs
- SelectionProcessor.cs
- MarkupExtensionReturnTypeAttribute.cs
- ElementAction.cs
- XmlILStorageConverter.cs
- PropertyCollection.cs
- MethodMessage.cs
- FormatException.cs
- MatrixCamera.cs
- ExeConfigurationFileMap.cs
- WsiProfilesElement.cs