00001 using System;
00002 using System.IO;
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 namespace Tamir.Streams
00035 {
00039 public class CombinedStream : Stream
00040 {
00041 private Stream m_in;
00042 private Stream m_out;
00043
00044 public CombinedStream(Stream inputStream, Stream outputStream)
00045 {
00046 this.m_in=inputStream;
00047 this.m_out=outputStream;
00048 }
00049
00057 public override int Read(byte[] buffer, int offset, int count)
00058 {
00059 return m_in.Read(buffer, offset, count);
00060 }
00061
00067 public virtual int Read(byte[] buffer)
00068 {
00069 return Read(buffer, 0, buffer.Length);
00070 }
00071
00076 public override int ReadByte()
00077 {
00078 return m_in.ReadByte();
00079 }
00080
00085 public override void WriteByte(byte value)
00086 {
00087 m_out.WriteByte(value);
00088 }
00089
00096 public override void Write(byte[] buffer, int offset, int count)
00097 {
00098 m_out.Write(buffer, offset, count);
00099 }
00100
00105 public virtual void Write(byte[] buffer)
00106 {
00107 Write(buffer, 0, buffer.Length);
00108 }
00109
00110
00114 public override void Close()
00115 {
00116 try
00117 {
00118 base.Close ();
00119 m_in.Close();
00120 m_out.Close();
00121 }
00122 catch{}
00123 }
00124
00128 public override bool CanRead
00129 {
00130 get
00131 {
00132 return m_in.CanRead;
00133 }
00134 }
00135
00139 public override bool CanWrite
00140 {
00141 get
00142 {
00143 return m_out.CanWrite;
00144 }
00145 }
00146
00150 public override bool CanSeek
00151 {
00152 get
00153 {
00154 return false;
00155 }
00156 }
00157
00161 public override void Flush()
00162 {
00163 m_out.Flush();
00164 }
00165
00169 public override long Length
00170 {
00171 get
00172 {
00173 return 0;
00174 }
00175 }
00176
00180 public override long Position
00181 {
00182 get
00183 {
00184 return 0;
00185 }
00186 set
00187 {
00188 }
00189 }
00190
00194 public override void SetLength(long value)
00195 {
00196 }
00197
00201 public override long Seek(long offset, SeekOrigin origin)
00202 {
00203 return 0;
00204 }
00205 }
00206 }