00001 using System;
00002 using IO = System.IO;
00003
00004 namespace Tamir.SharpSsh.java.io
00005 {
00009 public abstract class InputStream : IO.Stream
00010 {
00011 public virtual int read(byte[] buffer, int offset, int count)
00012 {
00013 return this.Read(buffer, offset, count);
00014 }
00015
00016 public virtual int read(byte[] buffer)
00017 {
00018 return this.Read(buffer, 0, buffer.Length);
00019 }
00020
00021 public virtual int read()
00022 {
00023 return this.ReadByte();
00024 }
00025
00026 public virtual void close()
00027 {
00028 Close();
00029 }
00030
00031 public override void WriteByte(byte value)
00032 {
00033 }
00034
00035 public override void Write(byte[] buffer, int offset, int count)
00036 {
00037 }
00038
00039 public override bool CanRead
00040 {
00041 get
00042 {
00043 return true;
00044 }
00045 }
00046 public override bool CanWrite
00047 {
00048 get
00049 {
00050 return false;
00051 }
00052 }
00053 public override bool CanSeek
00054 {
00055 get
00056 {
00057 return false;
00058 }
00059 }
00060 public override void Flush()
00061 {
00062
00063 }
00064 public override long Length
00065 {
00066 get
00067 {
00068 return 0;
00069 }
00070 }
00071 public override long Position
00072 {
00073 get
00074 {
00075 return 0;
00076 }
00077 set
00078 {
00079 }
00080 }
00081 public override void SetLength(long value)
00082 {
00083 }
00084 public override long Seek(long offset, IO.SeekOrigin origin)
00085 {
00086 return 0;
00087 }
00088
00089 public long skip(long len)
00090 {
00091
00092
00093 int i=0;
00094 int count = 0;
00095 byte[] buf = new byte[len];
00096 while(len>0)
00097 {
00098 i=Read(buf, count, (int)len);
00099 if(i<=0)
00100 {
00101 throw new Exception("inputstream is closed");
00102
00103 }
00104 count+=i;
00105 len-=i;
00106 }
00107 return count;
00108 }
00109 }
00110 }