1 /* ****************************************************************************
\r
3 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5 * This software is subject to the Microsoft Public License (Ms-PL).
\r
6 * A copy of the license can be found in the license.htm file included
\r
7 * in this distribution.
\r
9 * You must not remove this notice, or any other, from this software.
\r
11 * ***************************************************************************/
\r
13 namespace System.Web.Mvc {
\r
15 using System.Diagnostics.CodeAnalysis;
\r
18 public class FileContentResult : FileResult {
\r
20 public FileContentResult(byte[] fileContents, string contentType)
\r
21 : base(contentType) {
\r
22 if (fileContents == null) {
\r
23 throw new ArgumentNullException("fileContents");
\r
26 FileContents = fileContents;
\r
29 [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays",
\r
30 Justification = "There's no reason to tamper-proof this array since it's supplied to the type's constructor.")]
\r
31 public byte[] FileContents {
\r
36 protected override void WriteFile(HttpResponseBase response) {
\r
37 response.OutputStream.Write(FileContents, 0, FileContents.Length);
\r