Welcome to mirror list, hosted at ThFree Co, Russian Federation.

HttpResponseStream.cs « System.Web « System.Web « class « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 340a5a50442a6a93967de4139ca707ea0b6dc3a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// 
// System.Web.HttpResponseStream
//
// Author:
//   Patrik Torstensson (Patrik.Torstensson@labs2.com)
//
using System;
using System.IO;

namespace System.Web {
   /// <summary>
   /// Simple wrapper around HttpWriter to support the Stream interface
   /// </summary>
   public class HttpResponseStream : Stream {
      private HttpWriter _Writer;
	   
      internal HttpResponseStream(HttpWriter Writer) {
         _Writer = Writer;
      }
		
      public override void Flush() {
         _Writer.Flush();
      }

      public override void Close() {
         _Writer.Close();
      }

      public override int Read(byte [] buffer, int offset, int length) {
         throw new NotSupportedException();
      }

      public override long Seek(long offset, SeekOrigin origin) {
         throw new NotSupportedException();
      }

      public override void SetLength(long length) {
         throw new NotSupportedException();
      }

      public override void Write(byte [] buffer, int offset, int length) {
         if (offset < 0) {
            throw new ArgumentOutOfRangeException("offset");
         }

         if (length <= 0) {
            throw new ArgumentOutOfRangeException("length");
         }
		   
         _Writer.WriteBytes(buffer, offset, length);
      }

      public override bool CanRead {
         get {
            return false;
         }
      }

      public override bool CanSeek {
         get {
            return false;
         }
      }

      public override bool CanWrite {
         get {
            return true;
         }
      }

      public override long Length {
         get {
            throw new NotSupportedException();
         }
      }

      public override long Position {
         get {
            throw new NotSupportedException();
         }

         set {
            throw new NotSupportedException();
         }
      }
   }
}