2010-06-17 Marek Habersack <mhabersack@novell.com>
[mono.git] / mcs / class / System.Web / System.Web.J2EE / ObjectOutputStream.cs
1 //
2 // (C) 2005 Mainsoft Corporation (http://www.mainsoft.com)
3 //
4 // Authors:
5 //      Vladimir Krasnov <vladimirk@mainsoft.com>
6 //      Konstantin Triger <kostat@mainsoft.com>
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining
9 // a copy of this software and associated documentation files (the
10 // "Software"), to deal in the Software without restriction, including
11 // without limitation the rights to use, copy, modify, merge, publish,
12 // distribute, sublicense, and/or sell copies of the Software, and to
13 // permit persons to whom the Software is furnished to do so, subject to
14 // the following conditions:
15 //
16 // The above copyright notice and this permission notice shall be
17 // included in all copies or substantial portions of the Software.
18 //
19 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
23 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 //
27
28 using System;
29 using java.io;
30
31 namespace Mainsoft.Web.Hosting
32 {
33         public sealed class ObjectOutputStream : System.IO.Stream, ObjectOutput
34         {
35                 readonly ObjectOutput _javaObjectOutput;
36
37                 public ObjectOutputStream (ObjectOutput stream)
38                 {
39                         _javaObjectOutput = stream;
40                 }
41
42                 public override bool CanRead
43                 {
44                         get
45                         {
46                                 return false;
47                         }
48                 }
49
50                 public override bool CanSeek
51                 {
52                         get
53                         {
54                                 return false;
55                         }
56                 }
57
58                 public override bool CanWrite
59                 {
60                         get
61                         {
62                                 return true;
63                         }
64                 }
65
66                 public override void Close ()
67                 {
68                         _javaObjectOutput.close ();
69                 }
70
71                 public override void Flush ()
72                 {
73                         _javaObjectOutput.flush ();
74                 }
75
76                 public override long Length
77                 {
78                         get
79                         {
80                                 throw new NotSupportedException ();
81                         }
82                 }
83
84                 public override long Position
85                 {
86                         get
87                         {
88                                 throw new NotSupportedException ();
89                         }
90                         set
91                         {
92                                 throw new NotSupportedException ();
93                         }
94                 }
95
96                 public override long Seek (long offset, System.IO.SeekOrigin origin)
97                 {
98                         throw new NotSupportedException ();
99                 }
100
101                 public override void SetLength (long value)
102                 {
103                         throw new NotSupportedException ();
104                 }
105
106                 public override int Read (byte [] buffer, int offset, int count)
107                 {
108                         throw new NotSupportedException ();
109                 }
110
111                 public override void Write (byte [] buffer, int offset, int count)
112                 {
113                         _javaObjectOutput.write (vmw.common.TypeUtils.ToSByteArray (buffer), offset, count);
114                 }
115
116                 public override void WriteByte (byte value)
117                 {
118                         _javaObjectOutput.write (value);
119                 }
120
121                 public ObjectOutput NativeStream
122                 {
123                         get { return _javaObjectOutput; }
124                 }
125
126                 #region ObjectOutput Members
127
128                 public void close ()
129                 {
130                         _javaObjectOutput.close ();
131                 }
132
133                 public void flush ()
134                 {
135                         _javaObjectOutput.flush ();
136                 }
137
138                 public void write (sbyte [] __p1, int __p2, int __p3)
139                 {
140                         _javaObjectOutput.write (__p1, __p2, __p3);
141                 }
142
143                 public void write (sbyte [] __p1)
144                 {
145                         _javaObjectOutput.write (__p1);
146                 }
147
148                 public void write (int __p1)
149                 {
150                         _javaObjectOutput.write (__p1);
151                 }
152
153                 public void writeObject (object __p1)
154                 {
155                         _javaObjectOutput.writeObject (__p1);
156                 }
157
158                 #endregion
159
160                 #region DataOutput Members
161
162
163                 public void writeBoolean (bool __p1)
164                 {
165                         _javaObjectOutput.writeBoolean (__p1);
166                 }
167
168                 public void writeByte (int __p1)
169                 {
170                         _javaObjectOutput.writeByte (__p1);
171                 }
172
173                 public void writeBytes (string __p1)
174                 {
175                         _javaObjectOutput.writeBytes (__p1);
176                 }
177
178                 public void writeChar (int __p1)
179                 {
180                         _javaObjectOutput.writeChar (__p1);
181                 }
182
183                 public void writeChars (string __p1)
184                 {
185                         _javaObjectOutput.writeChars (__p1);
186                 }
187
188                 public void writeDouble (double __p1)
189                 {
190                         _javaObjectOutput.writeDouble (__p1);
191                 }
192
193                 public void writeFloat (float __p1)
194                 {
195                         _javaObjectOutput.writeFloat (__p1);
196                 }
197
198                 public void writeInt (int __p1)
199                 {
200                         _javaObjectOutput.writeInt (__p1);
201                 }
202
203                 public void writeLong (long __p1)
204                 {
205                         _javaObjectOutput.writeLong (__p1);
206                 }
207
208                 public void writeShort (int __p1)
209                 {
210                         _javaObjectOutput.writeShort (__p1);
211                 }
212
213                 public void writeUTF (string __p1)
214                 {
215                         _javaObjectOutput.writeUTF (__p1);
216                 }
217
218                 #endregion
219         }
220 }