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
- ContentHostHelper.cs
- HtmlTableCell.cs
- ToolStripSeparatorRenderEventArgs.cs
- AnonymousIdentificationModule.cs
- Button.cs
- Peer.cs
- FontClient.cs
- FlowPosition.cs
- ComponentEditorForm.cs
- ReliableRequestSessionChannel.cs
- ScriptingProfileServiceSection.cs
- RewritingSimplifier.cs
- SectionRecord.cs
- HtmlLink.cs
- ActiveXContainer.cs
- ToolboxItemFilterAttribute.cs
- OleDbConnection.cs
- AlphaSortedEnumConverter.cs
- OleServicesContext.cs
- ResourceDisplayNameAttribute.cs
- HttpRequestBase.cs
- FilterFactory.cs
- BulletedListEventArgs.cs
- InputScopeNameConverter.cs
- DefaultProxySection.cs
- RowsCopiedEventArgs.cs
- ThreadAbortException.cs
- ZoneIdentityPermission.cs
- SqlInfoMessageEvent.cs
- DataControlFieldHeaderCell.cs
- OdbcEnvironment.cs
- RuntimeCompatibilityAttribute.cs
- XmlUrlResolver.cs
- CustomExpression.cs
- XmlSchemaProviderAttribute.cs
- MessageLoggingElement.cs
- SQLRoleProvider.cs
- TaskFormBase.cs
- CasesDictionary.cs
- NamedPipeAppDomainProtocolHandler.cs
- SmiMetaData.cs
- MenuBase.cs
- LineServicesCallbacks.cs
- TypedRowGenerator.cs
- ResourceReferenceExpression.cs
- PartialCachingControl.cs
- BaseCollection.cs
- BamlVersionHeader.cs
- DataGridHeaderBorder.cs
- SingleStorage.cs
- WebPartZone.cs
- PartialCachingAttribute.cs
- GeneralTransformGroup.cs
- PasswordTextContainer.cs
- ToggleButton.cs
- SignedXml.cs
- DataServiceException.cs
- FamilyTypeface.cs
- NativeMethods.cs
- TreeIterator.cs
- CodeIdentifier.cs
- SiteMapProvider.cs
- SqlNamer.cs
- columnmapkeybuilder.cs
- LoginUtil.cs
- NameValueSectionHandler.cs
- _SslState.cs
- SymbolMethod.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- Point.cs
- BoundColumn.cs
- BackgroundFormatInfo.cs
- AnnotationAdorner.cs
- SchemaLookupTable.cs
- PerfCounters.cs
- GridViewDeletedEventArgs.cs
- BaseValidator.cs
- TypeContext.cs
- EntityKey.cs
- DynamicVirtualDiscoSearcher.cs
- TemplateApplicationHelper.cs
- ListViewInsertedEventArgs.cs
- Keyboard.cs
- BitmapScalingModeValidation.cs
- GridViewDeleteEventArgs.cs
- DockAndAnchorLayout.cs
- ToolTipAutomationPeer.cs
- ListViewGroup.cs
- Transform.cs
- NativeMethods.cs
- XsltQilFactory.cs
- GridViewColumnCollectionChangedEventArgs.cs
- RecoverInstanceLocksCommand.cs
- ComponentManagerBroker.cs
- CheckBox.cs
- RepeatInfo.cs
- WindowsToolbarAsMenu.cs
- UidPropertyAttribute.cs
- LogEntry.cs
- ConstraintConverter.cs