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
- DataGridViewCellLinkedList.cs
- EndPoint.cs
- WSFederationHttpBinding.cs
- GcHandle.cs
- initElementDictionary.cs
- Int32KeyFrameCollection.cs
- safex509handles.cs
- DataBindingCollectionEditor.cs
- CacheOutputQuery.cs
- CompensationParticipant.cs
- VariableAction.cs
- PageThemeCodeDomTreeGenerator.cs
- InvalidPrinterException.cs
- InfiniteTimeSpanConverter.cs
- ListCollectionView.cs
- BevelBitmapEffect.cs
- XamlToRtfParser.cs
- SqlInternalConnectionSmi.cs
- BamlResourceDeserializer.cs
- DataGridViewAutoSizeColumnsModeEventArgs.cs
- DataGridToolTip.cs
- Attributes.cs
- EmbeddedObject.cs
- DataGridView.cs
- TablePatternIdentifiers.cs
- XmlSerializationReader.cs
- StyleHelper.cs
- SystemIPInterfaceProperties.cs
- ListenerAdapter.cs
- GenericRootAutomationPeer.cs
- DateTime.cs
- nulltextnavigator.cs
- Highlights.cs
- RepeaterItemEventArgs.cs
- SecurityException.cs
- CmsInterop.cs
- AddingNewEventArgs.cs
- PrePrepareMethodAttribute.cs
- SecurityValidationBehavior.cs
- XmlSchemaNotation.cs
- ViewRendering.cs
- MachineSettingsSection.cs
- UnmanagedBitmapWrapper.cs
- HitTestParameters.cs
- EdmError.cs
- Transactions.cs
- EnumerableRowCollection.cs
- Process.cs
- SqlOuterApplyReducer.cs
- BoolExpression.cs
- BookmarkManager.cs
- LinqDataSourceInsertEventArgs.cs
- SequenceNumber.cs
- ProjectionPathSegment.cs
- SqlGatherConsumedAliases.cs
- LambdaSerializationException.cs
- SafeIUnknown.cs
- SequenceDesigner.cs
- NameHandler.cs
- shaper.cs
- TableLayoutPanel.cs
- DisplayInformation.cs
- WindowsFormsLinkLabel.cs
- ParameterCollectionEditor.cs
- CommandField.cs
- PageSettings.cs
- ZipIOCentralDirectoryBlock.cs
- ArrayList.cs
- Stream.cs
- Highlights.cs
- UInt16Converter.cs
- Polygon.cs
- JapaneseLunisolarCalendar.cs
- GlyphRun.cs
- ResourceDictionary.cs
- TeredoHelper.cs
- ControlCachePolicy.cs
- wmiutil.cs
- MaskedTextProvider.cs
- DataRecordInternal.cs
- RelationshipType.cs
- OdbcConnectionStringbuilder.cs
- WmpBitmapDecoder.cs
- Pens.cs
- Message.cs
- SqlInternalConnection.cs
- SessionStateUtil.cs
- DbConnectionPool.cs
- Type.cs
- Selector.cs
- SectionXmlInfo.cs
- InputLanguageEventArgs.cs
- DataListAutoFormat.cs
- CriticalExceptions.cs
- ExpandCollapseProviderWrapper.cs
- HttpConfigurationContext.cs
- DockPanel.cs
- ZoneMembershipCondition.cs
- PersistenceProviderBehavior.cs
- NativeMethods.cs