Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- BamlTreeMap.cs
- cookiecollection.cs
- ImpersonateTokenRef.cs
- ReadOnlyCollection.cs
- UInt64Storage.cs
- AddInDeploymentState.cs
- CompiledWorkflowDefinitionContext.cs
- GraphicsState.cs
- RemoteWebConfigurationHostServer.cs
- Region.cs
- SystemColors.cs
- IERequestCache.cs
- UriScheme.cs
- OrthographicCamera.cs
- PropertyCondition.cs
- OraclePermission.cs
- RtfToXamlReader.cs
- ProcessProtocolHandler.cs
- Formatter.cs
- TextElementCollectionHelper.cs
- DLinqTableProvider.cs
- UriTemplateClientFormatter.cs
- ItemCheckEvent.cs
- HashSet.cs
- CalculatedColumn.cs
- AuthenticatingEventArgs.cs
- PerformanceCounterCategory.cs
- NavigatorInput.cs
- MexTcpBindingCollectionElement.cs
- input.cs
- HashStream.cs
- DictionaryEntry.cs
- LogReservationCollection.cs
- WindowsTooltip.cs
- WebPartsSection.cs
- NoneExcludedImageIndexConverter.cs
- DataGridViewColumnHeaderCell.cs
- HTMLTextWriter.cs
- DbProviderFactories.cs
- StorageMappingItemLoader.cs
- SweepDirectionValidation.cs
- KnownBoxes.cs
- ExpressionVisitorHelpers.cs
- Int64AnimationUsingKeyFrames.cs
- KeyboardDevice.cs
- ProgressiveCrcCalculatingStream.cs
- PieceNameHelper.cs
- ScalarConstant.cs
- SQLInt16Storage.cs
- MultipleViewProviderWrapper.cs
- ToolStripLocationCancelEventArgs.cs
- EventDescriptor.cs
- DeflateStreamAsyncResult.cs
- CLSCompliantAttribute.cs
- WindowPattern.cs
- AsyncDataRequest.cs
- UnknownBitmapDecoder.cs
- TranslateTransform.cs
- WebReferenceOptions.cs
- Rijndael.cs
- AssertSection.cs
- DataObject.cs
- LockedActivityGlyph.cs
- FormViewUpdateEventArgs.cs
- UTF8Encoding.cs
- DataRowChangeEvent.cs
- RowCache.cs
- DeclaredTypeValidatorAttribute.cs
- DecimalAnimationBase.cs
- XPathScanner.cs
- SessionStateModule.cs
- figurelength.cs
- BitmapSizeOptions.cs
- StylusCaptureWithinProperty.cs
- TextEndOfLine.cs
- IChannel.cs
- FileDialogCustomPlacesCollection.cs
- PenContexts.cs
- TCPListener.cs
- MultiByteCodec.cs
- TextBoxAutomationPeer.cs
- XamlFilter.cs
- DataGridViewAutoSizeColumnModeEventArgs.cs
- QueryOutputWriter.cs
- XmlTypeAttribute.cs
- GridToolTip.cs
- DataGridViewTopLeftHeaderCell.cs
- QueryCursorEventArgs.cs
- CssClassPropertyAttribute.cs
- securitycriticaldata.cs
- SimpleLine.cs
- HttpHeaderCollection.cs
- CollectionBuilder.cs
- IQueryable.cs
- SynchronizingStream.cs
- DockingAttribute.cs
- RemotingServices.cs
- ContextMenu.cs
- XmlCodeExporter.cs
- EncodingNLS.cs