// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information. using System.IO; using System.Net.Http.Headers; namespace System.Net.Http { /// /// Provides a implementation that returns a instance. /// This facilitates deserialization or other manipulation of the contents in memory. /// internal class MultipartMemoryStreamProvider : IMultipartStreamProvider { private static MultipartMemoryStreamProvider instance = new MultipartMemoryStreamProvider(); private MultipartMemoryStreamProvider() { } /// /// Gets a static instance of the /// public static MultipartMemoryStreamProvider Instance { get { return MultipartMemoryStreamProvider.instance; } } /// /// This implementation returns a instance. /// This facilitates deserialization or other manipulation of the contents in memory. /// /// The header fields describing the body parts content. Looking for header fields such as /// Content-Type and Content-Disposition can help provide the appropriate stream. In addition to using the information /// in the provided header fields, it is also possible to add new header fields or modify existing header fields. This can /// be useful to get around situations where the Content-type may say application/octet-stream but based on /// analyzing the Content-Disposition header field it is found that the content in fact is application/json, for example. /// A stream instance where the contents of a body part will be written to. public Stream GetStream(HttpContentHeaders headers) { if (headers == null) { throw new ArgumentNullException("headers"); } return new MemoryStream(); } } }