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
- VirtualizingPanel.cs
- Maps.cs
- XmlNotation.cs
- TableParagraph.cs
- DesignerProperties.cs
- DesignerOptionService.cs
- CommonBehaviorsSection.cs
- CngUIPolicy.cs
- EntityAdapter.cs
- TaiwanLunisolarCalendar.cs
- SafeEventLogWriteHandle.cs
- XmlWrappingReader.cs
- TrustLevel.cs
- InitializationEventAttribute.cs
- DependencyPropertyKind.cs
- ConstNode.cs
- MediaContextNotificationWindow.cs
- CellIdBoolean.cs
- WebPartHelpVerb.cs
- EmptyReadOnlyDictionaryInternal.cs
- RadioButtonList.cs
- TextLineBreak.cs
- XhtmlTextWriter.cs
- ColumnPropertiesGroup.cs
- ProcessHostMapPath.cs
- WebScriptServiceHost.cs
- TrackBarRenderer.cs
- MenuCommand.cs
- SafeMILHandleMemoryPressure.cs
- UserControlParser.cs
- XmlBinaryReaderSession.cs
- ThaiBuddhistCalendar.cs
- SchemaTableColumn.cs
- JournalEntryStack.cs
- DBConcurrencyException.cs
- ColorBlend.cs
- BaseParaClient.cs
- Vector.cs
- IpcClientManager.cs
- Emitter.cs
- MergeFilterQuery.cs
- BinHexDecoder.cs
- DocumentViewerAutomationPeer.cs
- DescendentsWalkerBase.cs
- PixelFormatConverter.cs
- DataGridAddNewRow.cs
- LinearQuaternionKeyFrame.cs
- HttpServerUtilityBase.cs
- ASCIIEncoding.cs
- SiteMapDataSourceView.cs
- ContactManager.cs
- LicFileLicenseProvider.cs
- DataServiceOperationContext.cs
- FileSystemInfo.cs
- InArgumentConverter.cs
- SafeNativeMethods.cs
- TextEditorTyping.cs
- AtlasWeb.Designer.cs
- FlagsAttribute.cs
- InkCollectionBehavior.cs
- MasterPage.cs
- WaitHandleCannotBeOpenedException.cs
- KeyTime.cs
- Matrix3D.cs
- GridViewUpdateEventArgs.cs
- Focus.cs
- WebDescriptionAttribute.cs
- Int32CollectionConverter.cs
- Rotation3D.cs
- SubqueryRules.cs
- FlowDocumentView.cs
- OracleConnectionFactory.cs
- GetIndexBinder.cs
- Model3D.cs
- IsolatedStorageFilePermission.cs
- UseManagedPresentationElement.cs
- Comparer.cs
- BitmapFrameDecode.cs
- HelpEvent.cs
- GridPattern.cs
- ProfileSection.cs
- AlternateViewCollection.cs
- Span.cs
- WebPart.cs
- wmiprovider.cs
- Mapping.cs
- JoinElimination.cs
- LineUtil.cs
- SelectionItemPattern.cs
- EmptyImpersonationContext.cs
- DataContractSerializerMessageContractImporter.cs
- AudienceUriMode.cs
- assemblycache.cs
- Parser.cs
- RSAPKCS1SignatureDeformatter.cs
- RectangleConverter.cs
- PersonalizationProvider.cs
- PackageFilter.cs
- SqlBuffer.cs
- SamlAction.cs