home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1999 April / DPPCPRO0499.ISO / April / Notes / 50b2wic.exe / DATA1.CAB / NotesProgramFilesJavaSupport / rt.jar / java / io / StringBufferInputStream.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-04-23  |  1016 b   |  65 lines

  1. package java.io;
  2.  
  3. /** @deprecated */
  4. public class StringBufferInputStream extends InputStream {
  5.    protected String buffer;
  6.    protected int pos;
  7.    protected int count;
  8.  
  9.    public StringBufferInputStream(String var1) {
  10.       this.buffer = var1;
  11.       this.count = var1.length();
  12.    }
  13.  
  14.    public synchronized int read() {
  15.       return this.pos < this.count ? this.buffer.charAt(this.pos++) & 255 : -1;
  16.    }
  17.  
  18.    public synchronized int read(byte[] var1, int var2, int var3) {
  19.       if (this.pos >= this.count) {
  20.          return -1;
  21.       } else {
  22.          if (this.pos + var3 > this.count) {
  23.             var3 = this.count - this.pos;
  24.          }
  25.  
  26.          if (var3 <= 0) {
  27.             return 0;
  28.          } else {
  29.             String var4 = this.buffer;
  30.             int var5 = var3;
  31.  
  32.             while(true) {
  33.                --var5;
  34.                if (var5 < 0) {
  35.                   return var3;
  36.                }
  37.  
  38.                var1[var2++] = (byte)var4.charAt(this.pos++);
  39.             }
  40.          }
  41.       }
  42.    }
  43.  
  44.    public synchronized long skip(long var1) {
  45.       if (var1 < 0L) {
  46.          return 0L;
  47.       } else {
  48.          if (var1 > (long)(this.count - this.pos)) {
  49.             var1 = (long)(this.count - this.pos);
  50.          }
  51.  
  52.          this.pos = (int)((long)this.pos + var1);
  53.          return var1;
  54.       }
  55.    }
  56.  
  57.    public synchronized int available() {
  58.       return this.count - this.pos;
  59.    }
  60.  
  61.    public synchronized void reset() {
  62.       this.pos = 0;
  63.    }
  64. }
  65.