Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- ToolStripContentPanel.cs
- SecurityCookieModeValidator.cs
- TextInfo.cs
- ToolStripDropTargetManager.cs
- TextSelectionProcessor.cs
- ReferenceConverter.cs
- MenuTracker.cs
- CompModSwitches.cs
- EntityDesignerDataSourceView.cs
- StructuredProperty.cs
- Exception.cs
- SecurityTokenRequirement.cs
- Int64.cs
- RootNamespaceAttribute.cs
- Process.cs
- ProtocolsConfiguration.cs
- DateTimeFormat.cs
- SuppressMessageAttribute.cs
- TemplatedMailWebEventProvider.cs
- Pair.cs
- SHA1CryptoServiceProvider.cs
- BinaryObjectReader.cs
- EpmTargetPathSegment.cs
- SparseMemoryStream.cs
- SmiTypedGetterSetter.cs
- Util.cs
- ClientSettingsStore.cs
- ProjectionAnalyzer.cs
- HtmlElement.cs
- MethodBody.cs
- DataComponentNameHandler.cs
- PrintSystemException.cs
- Quad.cs
- OpacityConverter.cs
- StylusEditingBehavior.cs
- MailAddressCollection.cs
- _BaseOverlappedAsyncResult.cs
- OperationResponse.cs
- ListBox.cs
- _DigestClient.cs
- PnrpPermission.cs
- OutputWindow.cs
- CustomUserNameSecurityTokenAuthenticator.cs
- NullableLongMinMaxAggregationOperator.cs
- Color.cs
- EditingContext.cs
- ClrProviderManifest.cs
- DescendentsWalker.cs
- TableLayoutRowStyleCollection.cs
- GenericsInstances.cs
- HttpEncoderUtility.cs
- Schema.cs
- DataBoundControlHelper.cs
- AdornerDecorator.cs
- ScriptIgnoreAttribute.cs
- ModelItemCollection.cs
- OptimizerPatterns.cs
- BitmapCodecInfoInternal.cs
- CertificateManager.cs
- ReturnType.cs
- ModuleElement.cs
- LinkDescriptor.cs
- NameTable.cs
- RequestNavigateEventArgs.cs
- TextTreeUndoUnit.cs
- ProcessHostServerConfig.cs
- SBCSCodePageEncoding.cs
- TitleStyle.cs
- InstanceDataCollectionCollection.cs
- DataColumn.cs
- ExpressionPrinter.cs
- ValueUtilsSmi.cs
- BinaryMessageFormatter.cs
- WsdlImporter.cs
- WebEvents.cs
- RequestDescription.cs
- TextMetrics.cs
- XPathMessageFilterElementCollection.cs
- RadioButtonStandardAdapter.cs
- ActivityExecutor.cs
- DependencyPropertyChangedEventArgs.cs
- OrderedDictionary.cs
- AuthenticationModuleElement.cs
- DelayLoadType.cs
- HwndAppCommandInputProvider.cs
- IApplicationTrustManager.cs
- ObservableCollectionDefaultValueFactory.cs
- OrderingInfo.cs
- Helper.cs
- EntityContainer.cs
- XmlSchemaComplexContent.cs
- PathNode.cs
- Exception.cs
- ContainerParaClient.cs
- SoapIgnoreAttribute.cs
- ArgumentNullException.cs
- ExpressionHelper.cs
- CollectionBase.cs
- StringDictionary.cs
- FontFamilyConverter.cs