home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 24 / CDACTUAL24.iso / corel / BARISTA / ANIMATIONLIB / SWAPPEDDATAINPUTSTREAM.CLASS (.txt) < prev    next >
Encoding:
Java Class File  |  1997-07-24  |  1.6 KB  |  100 lines

  1. package animationlib;
  2.  
  3. import java.io.IOException;
  4. import java.io.InputStream;
  5.  
  6. public class SwappedDataInputStream extends InputStream {
  7.    // $FF: renamed from: is java.io.InputStream
  8.    InputStream field_0;
  9.    long pos;
  10.  
  11.    public SwappedDataInputStream(InputStream var1) {
  12.       this.field_0 = var1;
  13.    }
  14.  
  15.    public long curPos() {
  16.       return this.pos;
  17.    }
  18.  
  19.    public int read() throws IOException {
  20.       int var1 = this.field_0.read();
  21.       if (var1 < 0) {
  22.          return -1;
  23.       } else {
  24.          ++this.pos;
  25.          return var1;
  26.       }
  27.    }
  28.  
  29.    public int read(byte[] var1) throws IOException {
  30.       return this.read(var1, 0, var1.length);
  31.    }
  32.  
  33.    public int read(byte[] var1, int var2, int var3) throws IOException {
  34.       int var4 = this.field_0.read(var1, var2, var3);
  35.       if (var4 < 0) {
  36.          return -1;
  37.       } else {
  38.          this.pos += (long)var4;
  39.          return var4;
  40.       }
  41.    }
  42.  
  43.    public short readShort() throws IOException {
  44.       byte[] var1 = new byte[]{0, 0};
  45.       short var2 = 255;
  46.       short var3 = 0;
  47.       int var4 = this.read(var1, 0, 2);
  48.       if (var4 < 2) {
  49.          throw new IOException();
  50.       } else {
  51.          var3 = (short)(var3 | (short)var1[1] << 8);
  52.          var3 = (short)(var3 | (short)var1[0] & var2);
  53.          return var3;
  54.       }
  55.    }
  56.  
  57.    public int readInt() throws IOException {
  58.       byte[] var1 = new byte[]{0, 0, 0, 0};
  59.       short var2 = 255;
  60.       int var3 = 0;
  61.       int var4 = this.read(var1, 0, 4);
  62.       if (var4 < 4) {
  63.          throw new IOException();
  64.       } else {
  65.          var3 |= ((short)var1[3] & var2) << 24;
  66.          var3 |= ((short)var1[2] & var2) << 16;
  67.          var3 |= ((short)var1[1] & var2) << 8;
  68.          var3 |= (short)var1[0] & var2;
  69.          return var3;
  70.       }
  71.    }
  72.  
  73.    public int available() throws IOException {
  74.       return this.field_0.available();
  75.    }
  76.  
  77.    public void close() throws IOException {
  78.       this.field_0.close();
  79.    }
  80.  
  81.    public void mark(int var1) {
  82.       this.field_0.mark(var1);
  83.    }
  84.  
  85.    public boolean markSupported() {
  86.       return this.field_0.markSupported();
  87.    }
  88.  
  89.    public void reset() throws IOException {
  90.       this.field_0.reset();
  91.       this.pos = 0L;
  92.    }
  93.  
  94.    public long skip(long var1) throws IOException {
  95.       long var3 = this.field_0.skip(var1);
  96.       this.pos += var3;
  97.       return var3;
  98.    }
  99. }
  100.