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
- DataProtectionSecurityStateEncoder.cs
- NamedPermissionSet.cs
- ObjectFullSpanRewriter.cs
- MdiWindowListItemConverter.cs
- SplineKeyFrames.cs
- ServicesUtilities.cs
- HTTPNotFoundHandler.cs
- GenerateTemporaryTargetAssembly.cs
- WpfKnownMemberInvoker.cs
- WebPartActionVerb.cs
- ValidatorCollection.cs
- DataGridComboBoxColumn.cs
- ExpressionPrefixAttribute.cs
- BevelBitmapEffect.cs
- RtType.cs
- SetUserLanguageRequest.cs
- OverflowException.cs
- FormViewInsertEventArgs.cs
- X509AsymmetricSecurityKey.cs
- MobileComponentEditorPage.cs
- HttpListenerPrefixCollection.cs
- StaticDataManager.cs
- mediaeventshelper.cs
- DataGridViewAutoSizeModeEventArgs.cs
- EntityDesignerDataSourceView.cs
- ChameleonKey.cs
- MenuItemBinding.cs
- ImageField.cs
- StrokeNodeEnumerator.cs
- NetworkAddressChange.cs
- ByteStreamMessageEncoder.cs
- DnsElement.cs
- X509PeerCertificateElement.cs
- OdbcConnectionHandle.cs
- SoapRpcServiceAttribute.cs
- WorkflowDesignerColors.cs
- AlphabeticalEnumConverter.cs
- ColorAnimationBase.cs
- Html32TextWriter.cs
- initElementDictionary.cs
- XPathEmptyIterator.cs
- VBIdentifierTrimConverter.cs
- HwndSource.cs
- MatrixKeyFrameCollection.cs
- ResolveMatchesMessage11.cs
- BulletDecorator.cs
- DecodeHelper.cs
- ObjectHandle.cs
- FunctionDetailsReader.cs
- AlternateViewCollection.cs
- StylusOverProperty.cs
- StateMachine.cs
- SimpleExpression.cs
- FormViewInsertEventArgs.cs
- PnrpPermission.cs
- ServiceHttpModule.cs
- DBParameter.cs
- TextEditor.cs
- LingerOption.cs
- Bezier.cs
- PresentationSource.cs
- TextRangeEditLists.cs
- WebPartCatalogAddVerb.cs
- MarkupExtensionSerializer.cs
- FormsAuthenticationConfiguration.cs
- ParentQuery.cs
- DragEventArgs.cs
- SerializationHelper.cs
- DateTimeFormat.cs
- TemplatedAdorner.cs
- SmiEventSink_DeferedProcessing.cs
- ListenerServiceInstallComponent.cs
- Queue.cs
- CompoundFileDeflateTransform.cs
- DataGridViewImageCell.cs
- NavigationEventArgs.cs
- CompareValidator.cs
- DocumentsTrace.cs
- EdmMember.cs
- ColumnWidthChangingEvent.cs
- CryptoApi.cs
- TripleDESCryptoServiceProvider.cs
- StringOutput.cs
- AssemblyNameProxy.cs
- EventLogEntry.cs
- InvokeMethodActivity.cs
- RequestedSignatureDialog.cs
- SafeNativeMethods.cs
- SplineKeyFrames.cs
- Int32Converter.cs
- DmlSqlGenerator.cs
- DefaultWorkflowSchedulerService.cs
- WsdlBuildProvider.cs
- Quad.cs
- Button.cs
- Size3DConverter.cs
- TypeKeyValue.cs
- Process.cs
- HttpDebugHandler.cs
- LambdaCompiler.Statements.cs