1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle
.SvnHooks
21 /// Summary description for ReadOnlyStreamWrapper.
23 public class ReadOnlyStreamWrapper
: Stream
25 public ReadOnlyStreamWrapper(Stream source
)
28 throw new ArgumentException("Source stream must be readable", "source");
34 public override int Read(byte[] buffer
, int offset
, int count
)
36 return Source
.Read(buffer
, offset
, count
);
39 public override long Seek(long offset
, SeekOrigin origin
)
41 return Source
.Seek(offset
, origin
);
45 public override long Length
53 public override long Position
57 return Source
.Position
;
61 Source
.Position
= value;
65 public override bool CanSeek
69 return Source
.CanSeek
;
74 public override bool CanRead
82 public override bool CanWrite
91 #region Write related overrides
93 public override void Flush()
97 public override void SetLength(long value)
99 throw new InvalidOperationException();
102 public override void Write(byte[] buffer
, int offset
, int count
)
104 throw new InvalidOperationException();
110 private readonly Stream Source
;