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
- UnionCodeGroup.cs
- AliasExpr.cs
- CodeValidator.cs
- Parser.cs
- Visitor.cs
- XmlCDATASection.cs
- SRef.cs
- DataPagerCommandEventArgs.cs
- ResumeStoryboard.cs
- TypeReference.cs
- WindowsListViewGroup.cs
- StatusBarDrawItemEvent.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- GroupByQueryOperator.cs
- HitTestWithGeometryDrawingContextWalker.cs
- DropDownList.cs
- DataKeyArray.cs
- NetTcpBinding.cs
- UnauthorizedAccessException.cs
- RegexGroupCollection.cs
- WebPartCatalogCloseVerb.cs
- RegexBoyerMoore.cs
- FileDetails.cs
- CatalogPartChrome.cs
- XamlGridLengthSerializer.cs
- HMACMD5.cs
- ActivityExecutionWorkItem.cs
- UnaryNode.cs
- XmlSequenceWriter.cs
- ProviderConnectionPoint.cs
- ChangesetResponse.cs
- ItemsControlAutomationPeer.cs
- XsdCachingReader.cs
- ScanQueryOperator.cs
- ContextMenu.cs
- RemoteCryptoSignHashRequest.cs
- XmlEncoding.cs
- SourceLocation.cs
- XmlNotation.cs
- Label.cs
- fixedPageContentExtractor.cs
- ExpandCollapsePattern.cs
- SharedDp.cs
- DeclarativeExpressionConditionDeclaration.cs
- Button.cs
- ContextProperty.cs
- FormClosingEvent.cs
- PanelStyle.cs
- IfAction.cs
- WorkflowOperationContext.cs
- AssemblyHash.cs
- XmlFormatExtensionPrefixAttribute.cs
- CompletedAsyncResult.cs
- NativeObjectSecurity.cs
- CustomErrorCollection.cs
- SkinBuilder.cs
- PeerSecurityHelpers.cs
- SvcMapFile.cs
- WeakReferenceEnumerator.cs
- ScrollBarRenderer.cs
- TextEditorDragDrop.cs
- CookielessHelper.cs
- DashStyle.cs
- HashHelper.cs
- TextFormatter.cs
- ImageClickEventArgs.cs
- UserInitiatedNavigationPermission.cs
- QuaternionIndependentAnimationStorage.cs
- DocumentApplication.cs
- CursorConverter.cs
- DecimalSumAggregationOperator.cs
- ImageCollectionCodeDomSerializer.cs
- CollectionChangedEventManager.cs
- BeginEvent.cs
- KeyPullup.cs
- ComboBox.cs
- PointUtil.cs
- SchemaContext.cs
- ExeConfigurationFileMap.cs
- InternalConfigHost.cs
- XsltSettings.cs
- userdatakeys.cs
- ProfilePropertyNameValidator.cs
- CodePageEncoding.cs
- Method.cs
- PreviewKeyDownEventArgs.cs
- MouseWheelEventArgs.cs
- SqlDataSourceCache.cs
- UpdateEventArgs.cs
- OleDbPropertySetGuid.cs
- SessionPageStatePersister.cs
- BaseTreeIterator.cs
- BaseCollection.cs
- TableItemStyle.cs
- PrintPageEvent.cs
- Brush.cs
- ValidationRuleCollection.cs
- MenuBase.cs
- CrossContextChannel.cs
- AuthenticatedStream.cs