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
- Internal.cs
- WhitespaceRuleLookup.cs
- XmlSchemaAttributeGroupRef.cs
- DSACryptoServiceProvider.cs
- AutomationElementCollection.cs
- LabelLiteral.cs
- ServiceOperationDetailViewControl.cs
- AttributeAction.cs
- RegexTypeEditor.cs
- NodeCounter.cs
- AssertHelper.cs
- OpCopier.cs
- RelationshipEndMember.cs
- EntityException.cs
- FileEnumerator.cs
- KnownBoxes.cs
- NavigationExpr.cs
- PropertyPath.cs
- FixUp.cs
- DrawingDrawingContext.cs
- FrameworkElementFactory.cs
- DataGridColumnHeaderCollection.cs
- InputLangChangeRequestEvent.cs
- Durable.cs
- Formatter.cs
- TickBar.cs
- EntitySqlQueryBuilder.cs
- XmlChildNodes.cs
- RawAppCommandInputReport.cs
- KeyedHashAlgorithm.cs
- _SafeNetHandles.cs
- DetailsViewPagerRow.cs
- Rectangle.cs
- Normalization.cs
- DictionaryKeyPropertyAttribute.cs
- MappingModelBuildProvider.cs
- CompositeDataBoundControl.cs
- SchemaElementLookUpTable.cs
- SerializationException.cs
- ProcessProtocolHandler.cs
- EmptyStringExpandableObjectConverter.cs
- TypeBinaryExpression.cs
- Compiler.cs
- WindowsStreamSecurityElement.cs
- EntityTypeBase.cs
- XmlNodeReader.cs
- PermissionSetEnumerator.cs
- SafeIUnknown.cs
- CqlLexerHelpers.cs
- ObjectStateFormatter.cs
- Converter.cs
- KnownBoxes.cs
- BoundConstants.cs
- ContentFilePart.cs
- SecurityContext.cs
- DiagnosticsConfigurationHandler.cs
- SkewTransform.cs
- AspNetHostingPermission.cs
- XamlReader.cs
- DataGridViewImageColumn.cs
- basenumberconverter.cs
- Brushes.cs
- LongMinMaxAggregationOperator.cs
- dsa.cs
- DbgCompiler.cs
- sqlmetadatafactory.cs
- CqlQuery.cs
- RenamedEventArgs.cs
- QilExpression.cs
- MappingMetadataHelper.cs
- SplineQuaternionKeyFrame.cs
- WebPartCollection.cs
- PropertyDescriptorComparer.cs
- CompiledIdentityConstraint.cs
- ThicknessAnimationBase.cs
- DashStyle.cs
- AuthenticationService.cs
- MessageDesigner.cs
- CodeDirectiveCollection.cs
- RetrieveVirtualItemEventArgs.cs
- ListViewItemMouseHoverEvent.cs
- OleDbStruct.cs
- JpegBitmapDecoder.cs
- ListControlStringCollectionEditor.cs
- OracleBFile.cs
- ExecutionContext.cs
- FixedTextContainer.cs
- RoleGroupCollection.cs
- WebScriptEnablingElement.cs
- Internal.cs
- DbDataAdapter.cs
- MetadataPropertyvalue.cs
- SplitterCancelEvent.cs
- MailAddressCollection.cs
- IdleTimeoutMonitor.cs
- CmsInterop.cs
- EditorPart.cs
- ContextMenuStripGroup.cs
- ExtensionSurface.cs
- StateInitialization.cs