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
- _PooledStream.cs
- XmlSignatureManifest.cs
- SizeAnimationBase.cs
- AliasedSlot.cs
- mediaeventargs.cs
- QilGenerator.cs
- AnimationTimeline.cs
- ClientRoleProvider.cs
- FrameworkElementAutomationPeer.cs
- Overlapped.cs
- SystemException.cs
- PropertyValueEditor.cs
- ByteAnimationBase.cs
- SyndicationDeserializer.cs
- SimpleLine.cs
- PasswordBox.cs
- KeyboardDevice.cs
- AsymmetricSignatureDeformatter.cs
- DataGridViewCheckBoxColumn.cs
- ConfigXmlComment.cs
- ClientConfigPaths.cs
- ViewStateModeByIdAttribute.cs
- MailMessage.cs
- CustomErrorsSection.cs
- ASCIIEncoding.cs
- MetadataItemSerializer.cs
- WaitHandleCannotBeOpenedException.cs
- AssemblyName.cs
- CompilationLock.cs
- KeyProperty.cs
- TypeReference.cs
- EntityUtil.cs
- ServiceRouteHandler.cs
- NamespaceEmitter.cs
- MetadataUtilsSmi.cs
- VectorAnimationUsingKeyFrames.cs
- SafeBitVector32.cs
- SrgsOneOf.cs
- XmlComplianceUtil.cs
- UpdatePanelTrigger.cs
- SymmetricAlgorithm.cs
- IndexedGlyphRun.cs
- InputMethodStateChangeEventArgs.cs
- SecurityPolicySection.cs
- CustomAttributeSerializer.cs
- CodeGeneratorOptions.cs
- EndpointDesigner.cs
- ListBoxItemAutomationPeer.cs
- ComplexObject.cs
- SiteMapPath.cs
- DbConnectionPoolOptions.cs
- RMEnrollmentPage2.cs
- DesignerRegion.cs
- ProcessHostConfigUtils.cs
- PerSessionInstanceContextProvider.cs
- SafeIUnknown.cs
- Grammar.cs
- QuaternionValueSerializer.cs
- MemberPathMap.cs
- AnnotationResourceCollection.cs
- RangeValidator.cs
- VectorCollectionConverter.cs
- Stylus.cs
- DiscoveryEndpoint.cs
- Metafile.cs
- EventMetadata.cs
- SoapSchemaExporter.cs
- TimerElapsedEvenArgs.cs
- HtmlString.cs
- XmlTextReaderImplHelpers.cs
- ConfigXmlDocument.cs
- StylusTip.cs
- WorkflowOperationInvoker.cs
- EntityCodeGenerator.cs
- WbemProvider.cs
- SqlTriggerContext.cs
- Point.cs
- HtmlEncodedRawTextWriter.cs
- SparseMemoryStream.cs
- EventLogTraceListener.cs
- URIFormatException.cs
- WebMessageEncodingBindingElement.cs
- PeerApplication.cs
- ReadOnlyHierarchicalDataSource.cs
- AppliesToBehaviorDecisionTable.cs
- SqlError.cs
- COM2Properties.cs
- HighContrastHelper.cs
- InvokeMemberBinder.cs
- AnimationClock.cs
- TextBox.cs
- CompilerState.cs
- RadioButtonBaseAdapter.cs
- ObjectDataProvider.cs
- DataObjectFieldAttribute.cs
- Ports.cs
- RootNamespaceAttribute.cs
- StandardOleMarshalObject.cs
- GroupLabel.cs
- Number.cs