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
- SafeLibraryHandle.cs
- COM2PictureConverter.cs
- RichTextBoxDesigner.cs
- Blend.cs
- Model3DGroup.cs
- SymmetricKeyWrap.cs
- HistoryEventArgs.cs
- ChannelBuilder.cs
- ToolStripDesignerAvailabilityAttribute.cs
- FontStyleConverter.cs
- arabicshape.cs
- RewritingProcessor.cs
- DataGridPagerStyle.cs
- SQLMembershipProvider.cs
- PowerModeChangedEventArgs.cs
- ObjectStateFormatter.cs
- Stopwatch.cs
- ReadOnlyTernaryTree.cs
- AssemblyAttributesGoHere.cs
- HTMLTagNameToTypeMapper.cs
- RectConverter.cs
- ThreadExceptionEvent.cs
- ConsoleCancelEventArgs.cs
- OptimizedTemplateContent.cs
- TextReader.cs
- InternalConfigConfigurationFactory.cs
- LinqDataSourceContextData.cs
- ToolStripItemTextRenderEventArgs.cs
- RewritingValidator.cs
- XhtmlBasicControlAdapter.cs
- RegexRunnerFactory.cs
- IProvider.cs
- OleDbParameterCollection.cs
- TextContainer.cs
- GPRECTF.cs
- WhiteSpaceTrimStringConverter.cs
- MultiTrigger.cs
- PersonalizationStateQuery.cs
- MenuStrip.cs
- CaseInsensitiveComparer.cs
- AstTree.cs
- SqlUserDefinedAggregateAttribute.cs
- ControlFilterExpression.cs
- DataGridCellsPanel.cs
- ADMembershipProvider.cs
- MemberPath.cs
- HttpFileCollection.cs
- CodeDelegateCreateExpression.cs
- WindowsFormsLinkLabel.cs
- OdbcConnectionPoolProviderInfo.cs
- MutexSecurity.cs
- Regex.cs
- TimeSpanOrInfiniteConverter.cs
- ResXDataNode.cs
- TextOutput.cs
- LocalizedNameDescriptionPair.cs
- DesignerActionUI.cs
- AssertFilter.cs
- NumericUpDown.cs
- DataServiceSaveChangesEventArgs.cs
- RequestNavigateEventArgs.cs
- DataGridTextBoxColumn.cs
- TemplateControlBuildProvider.cs
- CustomBindingCollectionElement.cs
- PersonalizationStateInfo.cs
- FixedPageProcessor.cs
- QueryCursorEventArgs.cs
- Pen.cs
- Logging.cs
- AccessDataSourceView.cs
- UniformGrid.cs
- QfeChecker.cs
- ToolStripItemEventArgs.cs
- SafeProcessHandle.cs
- PeerResolverBindingElement.cs
- _ConnectionGroup.cs
- StringUtil.cs
- ResourceSet.cs
- NotifyParentPropertyAttribute.cs
- FileSystemEventArgs.cs
- ListDataBindEventArgs.cs
- QueryInterceptorAttribute.cs
- ExportOptions.cs
- Pair.cs
- SimpleTextLine.cs
- HttpListenerTimeoutManager.cs
- ThreadPoolTaskScheduler.cs
- XmlSerializationWriter.cs
- TypeName.cs
- Attribute.cs
- SocketPermission.cs
- WindowsPen.cs
- AssemblyBuilder.cs
- BuildProvider.cs
- NameValueCollection.cs
- UIAgentMonitor.cs
- UserControlAutomationPeer.cs
- SubordinateTransaction.cs
- BoundField.cs
- DataGridViewColumnCollectionDialog.cs