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
- BroadcastEventHelper.cs
- ToolStripPanelCell.cs
- BackgroundFormatInfo.cs
- WebBrowserDocumentCompletedEventHandler.cs
- CommandBinding.cs
- SiteMap.cs
- XmlNodeList.cs
- PageAsyncTaskManager.cs
- OdbcEnvironment.cs
- HttpException.cs
- ItemCheckEvent.cs
- MaskedTextBoxTextEditor.cs
- PrePrepareMethodAttribute.cs
- SqlCacheDependencyDatabaseCollection.cs
- ImportFileRequest.cs
- FlagsAttribute.cs
- Figure.cs
- WinEventHandler.cs
- ButtonStandardAdapter.cs
- IndependentAnimationStorage.cs
- CodeRemoveEventStatement.cs
- DependencyPropertyKind.cs
- MetadataItem.cs
- BamlResourceSerializer.cs
- ObjectStateEntryDbDataRecord.cs
- TcpTransportManager.cs
- SharedPerformanceCounter.cs
- FontCollection.cs
- RangeValueProviderWrapper.cs
- XmlIlVisitor.cs
- XmlSignificantWhitespace.cs
- MultipleCopiesCollection.cs
- Setter.cs
- IndexOutOfRangeException.cs
- PictureBox.cs
- ExpressionQuoter.cs
- ScrollViewerAutomationPeer.cs
- GlyphsSerializer.cs
- PersonalizableTypeEntry.cs
- Endpoint.cs
- GuidTagList.cs
- BuildProvider.cs
- DataServiceKeyAttribute.cs
- MediaCommands.cs
- BitmapEffectInput.cs
- DbProviderFactory.cs
- SessionParameter.cs
- ActionFrame.cs
- Helpers.cs
- BoundConstants.cs
- GroupBox.cs
- MonthChangedEventArgs.cs
- FieldBuilder.cs
- Win32Exception.cs
- Button.cs
- DurableOperationContext.cs
- MarginsConverter.cs
- WebScriptClientGenerator.cs
- TcpClientChannel.cs
- ListItemCollection.cs
- BufferedGraphicsManager.cs
- GlyphCache.cs
- SessionPageStateSection.cs
- TabletDeviceInfo.cs
- EntityDataSourceState.cs
- Rotation3DAnimationUsingKeyFrames.cs
- PagesSection.cs
- ReachPageContentSerializer.cs
- COMException.cs
- SharedDp.cs
- StylusPlugInCollection.cs
- WeakReferenceList.cs
- AlignmentXValidation.cs
- MSAAEventDispatcher.cs
- linebase.cs
- XmlSchemaExporter.cs
- TerminatorSinks.cs
- MailDefinition.cs
- NamespaceQuery.cs
- CurrencyManager.cs
- SelectionHighlightInfo.cs
- PngBitmapDecoder.cs
- BitSet.cs
- PropertyCollection.cs
- ConfigurationStrings.cs
- DecimalAnimation.cs
- XmlNodeList.cs
- DetailsViewRowCollection.cs
- XmlIgnoreAttribute.cs
- PropertyNames.cs
- ColorInterpolationModeValidation.cs
- XmlStreamStore.cs
- EventHandlingScope.cs
- TextComposition.cs
- QueryableDataSource.cs
- ConfigsHelper.cs
- WebPartCatalogAddVerb.cs
- SendMailErrorEventArgs.cs
- SqlGatherConsumedAliases.cs
- DiffuseMaterial.cs