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
- AuthenticationManager.cs
- TaskExceptionHolder.cs
- _AutoWebProxyScriptEngine.cs
- HitTestWithPointDrawingContextWalker.cs
- XmlCharacterData.cs
- WpfGeneratedKnownTypes.cs
- WebBrowserHelper.cs
- GridViewDeleteEventArgs.cs
- ServerValidateEventArgs.cs
- WebPartConnectVerb.cs
- NonBatchDirectoryCompiler.cs
- EditCommandColumn.cs
- TemplatedControlDesigner.cs
- documentation.cs
- SchemaElementLookUpTable.cs
- ChtmlTextWriter.cs
- IISMapPath.cs
- HandlerBase.cs
- DesignerResources.cs
- BufferedStream.cs
- ResourceContainerWrapper.cs
- Missing.cs
- SByteStorage.cs
- DaylightTime.cs
- FakeModelPropertyImpl.cs
- InvalidFilterCriteriaException.cs
- ViewStateException.cs
- GradientStopCollection.cs
- RealProxy.cs
- FileLevelControlBuilderAttribute.cs
- Compress.cs
- CalendarDesigner.cs
- InternalDispatchObject.cs
- ObjectDataSourceEventArgs.cs
- RowUpdatedEventArgs.cs
- Canvas.cs
- StubHelpers.cs
- DocumentApplication.cs
- PropertyPushdownHelper.cs
- ScriptingScriptResourceHandlerSection.cs
- StandardBindingCollectionElement.cs
- BigInt.cs
- Focus.cs
- TextSelectionHighlightLayer.cs
- PriorityRange.cs
- MessageBox.cs
- ConstraintManager.cs
- CryptoProvider.cs
- RuleSettingsCollection.cs
- WindowsGraphics.cs
- Byte.cs
- propertytag.cs
- PointLight.cs
- XmlSchemaAnyAttribute.cs
- PopupRoot.cs
- CharAnimationBase.cs
- WebPartConnectVerb.cs
- DesignerOptionService.cs
- SqlFileStream.cs
- XPathNodeInfoAtom.cs
- DocumentGridPage.cs
- XPathParser.cs
- IdentityHolder.cs
- GeneralTransform2DTo3D.cs
- KnownBoxes.cs
- XmlJsonReader.cs
- ClockController.cs
- SecurityUtils.cs
- ValidationHelpers.cs
- QuarticEase.cs
- CancellationState.cs
- ProfileGroupSettingsCollection.cs
- SimpleWorkerRequest.cs
- HttpEncoderUtility.cs
- ExpressionTextBoxAutomationPeer.cs
- InertiaExpansionBehavior.cs
- ProfileGroupSettingsCollection.cs
- BindingExpressionUncommonField.cs
- BufferedOutputStream.cs
- RectangleGeometry.cs
- DynamicActivityXamlReader.cs
- UIElementCollection.cs
- SchemaDeclBase.cs
- IntellisenseTextBox.designer.cs
- RecommendedAsConfigurableAttribute.cs
- HuffCodec.cs
- XmlSchemaAnnotated.cs
- TerminateDesigner.cs
- HTTPNotFoundHandler.cs
- ValueExpressions.cs
- CompilerScope.cs
- LineServicesRun.cs
- DataRelationCollection.cs
- HttpDebugHandler.cs
- ShapeTypeface.cs
- InputBinder.cs
- EventProvider.cs
- DataAccessor.cs
- PropertyTabAttribute.cs
- MouseOverProperty.cs