Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataWeb / Server / System / Data / Services / Serializers / BinarySerializer.cs / 1305376 / BinarySerializer.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // //// Provides a serializer for binary content. // // // @owner [....] //--------------------------------------------------------------------- namespace System.Data.Services.Serializers { using System.Diagnostics; using System.IO; 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); } /// should be a byte array. Handles the complete serialization for the specified stream. /// Input stream to write out. /// Buffer size to use during copying. internal void WriteRequest(Stream inputStream, int bufferSize) { Debug.Assert(inputStream != null, "stream != null"); WebUtil.CopyStream(inputStream, this.outputStream, bufferSize); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // //// Provides a serializer for binary content. // // // @owner [....] //--------------------------------------------------------------------- namespace System.Data.Services.Serializers { using System.Diagnostics; using System.IO; 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); } /// should be a byte array. Handles the complete serialization for the specified stream. /// Input stream to write out. /// Buffer size to use during copying. internal void WriteRequest(Stream inputStream, int bufferSize) { Debug.Assert(inputStream != null, "stream != null"); WebUtil.CopyStream(inputStream, this.outputStream, bufferSize); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- RoleGroupCollection.cs
- ClientCredentials.cs
- PtsPage.cs
- mda.cs
- NavigationPropertyEmitter.cs
- State.cs
- BitmapScalingModeValidation.cs
- ReceiveCompletedEventArgs.cs
- TdsParserSafeHandles.cs
- LogEntrySerializer.cs
- Condition.cs
- X509WindowsSecurityToken.cs
- DesignTimeTemplateParser.cs
- InputLanguageProfileNotifySink.cs
- ToolStripDropDownButton.cs
- DataServiceResponse.cs
- LineInfo.cs
- DoubleAnimation.cs
- ThreadStaticAttribute.cs
- FillErrorEventArgs.cs
- ChannelBase.cs
- FixedElement.cs
- XmlSchemaAll.cs
- Rfc2898DeriveBytes.cs
- WindowsListView.cs
- WebUtil.cs
- FormsAuthentication.cs
- ForEachAction.cs
- XslAstAnalyzer.cs
- DataViewSettingCollection.cs
- WebPartVerb.cs
- TemplateContainer.cs
- HitTestParameters.cs
- IdnMapping.cs
- ArithmeticException.cs
- WindowsIPAddress.cs
- DifferencingCollection.cs
- LinearKeyFrames.cs
- RemoveStoryboard.cs
- PersonalizationState.cs
- TextAutomationPeer.cs
- AttributeEmitter.cs
- DependencyProperty.cs
- PermissionRequestEvidence.cs
- ColumnBinding.cs
- PictureBox.cs
- Int64Animation.cs
- FormsAuthenticationConfiguration.cs
- FacetDescription.cs
- LayoutDump.cs
- MethodExpr.cs
- CodeBinaryOperatorExpression.cs
- ContactManager.cs
- FillErrorEventArgs.cs
- SurrogateEncoder.cs
- ToolStripTextBox.cs
- SQLBytesStorage.cs
- IdnElement.cs
- ResourceCategoryAttribute.cs
- MessageDesigner.cs
- XXXInfos.cs
- CurrentTimeZone.cs
- EastAsianLunisolarCalendar.cs
- TabPanel.cs
- DPCustomTypeDescriptor.cs
- EntityCommandExecutionException.cs
- ClientTargetSection.cs
- FileSystemInfo.cs
- EventDescriptor.cs
- IntSecurity.cs
- XmlStringTable.cs
- OracleBFile.cs
- ObjectStateManager.cs
- RelatedImageListAttribute.cs
- WindowsSolidBrush.cs
- EmissiveMaterial.cs
- XmlParserContext.cs
- ChildDocumentBlock.cs
- TextElementCollectionHelper.cs
- ReceiveErrorHandling.cs
- EditorZone.cs
- ThumbAutomationPeer.cs
- XmlSchemaSimpleTypeUnion.cs
- Pkcs7Signer.cs
- QilFunction.cs
- LogicalMethodInfo.cs
- ValueSerializerAttribute.cs
- FullTextBreakpoint.cs
- HtmlTitle.cs
- ToolStripItemEventArgs.cs
- CreateUserErrorEventArgs.cs
- Hash.cs
- CheckBoxFlatAdapter.cs
- TextRenderer.cs
- UriWriter.cs
- XmlSchemaChoice.cs
- ScaleTransform3D.cs
- TypeRefElement.cs
- XmlUnspecifiedAttribute.cs
- FormViewPagerRow.cs