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
- SafeViewOfFileHandle.cs
- FrugalMap.cs
- TabItemWrapperAutomationPeer.cs
- Comparer.cs
- UntypedNullExpression.cs
- DiscreteKeyFrames.cs
- Visitor.cs
- SortedDictionary.cs
- Pens.cs
- MailSettingsSection.cs
- XhtmlBasicPageAdapter.cs
- TextEffect.cs
- CqlParser.cs
- Globals.cs
- ParallelQuery.cs
- XmlDocument.cs
- Style.cs
- PersonalizationProviderHelper.cs
- SharingService.cs
- DataRowView.cs
- FamilyTypeface.cs
- SqlCommandBuilder.cs
- RectangleHotSpot.cs
- Converter.cs
- IndexingContentUnit.cs
- TargetFrameworkAttribute.cs
- Base64Encoding.cs
- DescriptionAttribute.cs
- ToolboxItemCollection.cs
- CompositeClientFormatter.cs
- ExceptionHelpers.cs
- HttpRequest.cs
- DefaultTextStore.cs
- EntityTransaction.cs
- TextBlock.cs
- HtmlSelectionListAdapter.cs
- ContentType.cs
- ScriptingJsonSerializationSection.cs
- DataGridViewCellStyleConverter.cs
- XamlInt32CollectionSerializer.cs
- ContextMenu.cs
- Registration.cs
- Vector3DCollection.cs
- DataGridViewBand.cs
- Exceptions.cs
- CatalogPartChrome.cs
- GridLengthConverter.cs
- SafePipeHandle.cs
- ListDataHelper.cs
- GlyphRunDrawing.cs
- NullableConverter.cs
- PhoneCall.cs
- DataKeyCollection.cs
- SignatureHelper.cs
- UnsafeNativeMethodsTablet.cs
- XmlNodeChangedEventArgs.cs
- SymLanguageVendor.cs
- ClientBuildManager.cs
- MatrixKeyFrameCollection.cs
- UserNamePasswordValidationMode.cs
- SemaphoreSlim.cs
- HyperLinkField.cs
- GridViewRowPresenterBase.cs
- GraphicsState.cs
- ContentPlaceHolder.cs
- Msec.cs
- DesignerTransactionCloseEvent.cs
- HelloOperationAsyncResult.cs
- UTF8Encoding.cs
- HierarchicalDataBoundControl.cs
- AnonymousIdentificationModule.cs
- FormsIdentity.cs
- DataGrid.cs
- TextFormatterContext.cs
- NodeInfo.cs
- AudioFileOut.cs
- SoapExtensionTypeElementCollection.cs
- DocumentSequenceHighlightLayer.cs
- ExtendedPropertiesHandler.cs
- InvalidCommandTreeException.cs
- AccessedThroughPropertyAttribute.cs
- FormsAuthenticationCredentials.cs
- PhysicalAddress.cs
- PipelineModuleStepContainer.cs
- RequestNavigateEventArgs.cs
- CustomCategoryAttribute.cs
- FormViewUpdateEventArgs.cs
- _SSPIWrapper.cs
- IncrementalHitTester.cs
- FindCompletedEventArgs.cs
- PointAnimationBase.cs
- CutCopyPasteHelper.cs
- NativeMethods.cs
- AsymmetricSignatureFormatter.cs
- KeysConverter.cs
- RadioButton.cs
- MediaPlayerState.cs
- BaseTypeViewSchema.cs
- RadioButtonStandardAdapter.cs
- MonthChangedEventArgs.cs