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
- Column.cs
- SspiNegotiationTokenAuthenticator.cs
- SecurityIdentifierConverter.cs
- GenericTransactionFlowAttribute.cs
- HtmlButton.cs
- Monitor.cs
- DoubleUtil.cs
- webproxy.cs
- BaseInfoTable.cs
- DocumentPaginator.cs
- xmlsaver.cs
- FontCollection.cs
- OpCodes.cs
- DataGridCellsPanel.cs
- WindowsFormsSectionHandler.cs
- ActivityExecutionWorkItem.cs
- Brush.cs
- ObjectItemCollectionAssemblyCacheEntry.cs
- DispatcherFrame.cs
- HMACSHA256.cs
- ViewPort3D.cs
- RadioButtonList.cs
- ProfileEventArgs.cs
- documentsequencetextview.cs
- Matrix.cs
- TransferRequestHandler.cs
- InvalidWMPVersionException.cs
- TrackingMemoryStream.cs
- WebPartDisplayModeEventArgs.cs
- RegionInfo.cs
- BrowsableAttribute.cs
- PlanCompilerUtil.cs
- FontClient.cs
- LinkedResourceCollection.cs
- ImmutableCollection.cs
- CLSCompliantAttribute.cs
- _HeaderInfo.cs
- BuilderPropertyEntry.cs
- TypefaceCollection.cs
- ToolStripActionList.cs
- MetadataItemEmitter.cs
- CodeNamespaceCollection.cs
- AssemblyHash.cs
- ObjectToken.cs
- FilePrompt.cs
- MdiWindowListItemConverter.cs
- SqlInternalConnectionSmi.cs
- StylusPointProperty.cs
- DesignBindingValueUIHandler.cs
- ContentFilePart.cs
- TemplateBamlTreeBuilder.cs
- _ChunkParse.cs
- MergeFailedEvent.cs
- DataGridViewCellLinkedList.cs
- ToolConsole.cs
- EditorPart.cs
- UdpChannelFactory.cs
- ComplexTypeEmitter.cs
- FaultHandlingFilter.cs
- DataGridTextBox.cs
- Parameter.cs
- DbDataRecord.cs
- SpecialNameAttribute.cs
- NumericExpr.cs
- ImageCodecInfo.cs
- WebConfigurationHostFileChange.cs
- PenContexts.cs
- SafeEventHandle.cs
- TypographyProperties.cs
- ClaimSet.cs
- DesignTimeData.cs
- WindowsListView.cs
- BufferModeSettings.cs
- CssTextWriter.cs
- XmlBoundElement.cs
- InternalResources.cs
- ToolBarButtonClickEvent.cs
- CacheAxisQuery.cs
- XmlHierarchicalEnumerable.cs
- FileDialogCustomPlace.cs
- ViewGenResults.cs
- TemplateBindingExpressionConverter.cs
- PropertyEmitter.cs
- FieldReference.cs
- EventManager.cs
- TypeUsage.cs
- HttpPostServerProtocol.cs
- DataObjectSettingDataEventArgs.cs
- ProviderMetadata.cs
- HtmlTernaryTree.cs
- JournalEntryStack.cs
- FormatStringEditor.cs
- DataServiceQueryOfT.cs
- PeerNameResolver.cs
- DBCommandBuilder.cs
- CommandExpr.cs
- InputManager.cs
- CounterSetInstanceCounterDataSet.cs
- ResetableIterator.cs
- AdornedElementPlaceholder.cs