home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &n…he Search for Life DVD 2 / DVD-ROM.iso / install / jre1_3 / lib / rt.jar / java / util / zip / ZipFile$ZipFileInputStream.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  1.0 KB  |  78 lines

  1. package java.util.zip;
  2.  
  3. import java.io.IOException;
  4. import java.io.InputStream;
  5.  
  6. class ZipFile$ZipFileInputStream extends InputStream {
  7.    private long jzfile;
  8.    private long jzentry;
  9.    private int pos;
  10.    private int rem;
  11.    private int size;
  12.  
  13.    ZipFile$ZipFileInputStream(long var1, long var3) {
  14.       this.jzfile = var1;
  15.       this.jzentry = var3;
  16.       this.pos = 0;
  17.       this.rem = ZipFile.access$500(var3);
  18.       this.size = ZipFile.access$600(var3);
  19.    }
  20.  
  21.    public int read(byte[] var1, int var2, int var3) throws IOException {
  22.       if (this.rem == 0) {
  23.          return -1;
  24.       } else if (var3 <= 0) {
  25.          return 0;
  26.       } else {
  27.          if (var3 > this.rem) {
  28.             var3 = this.rem;
  29.          }
  30.  
  31.          var3 = ZipFile.access$700(this.jzfile, this.jzentry, this.pos, var1, var2, var3);
  32.          if (var3 > 0) {
  33.             this.pos += var3;
  34.             this.rem -= var3;
  35.          }
  36.  
  37.          if (this.rem == 0) {
  38.             this.cleanup();
  39.          }
  40.  
  41.          return var3;
  42.       }
  43.    }
  44.  
  45.    public int read() throws IOException {
  46.       byte[] var1 = new byte[1];
  47.       return this.read(var1, 0, 1) == 1 ? var1[0] & 255 : -1;
  48.    }
  49.  
  50.    public long skip(long var1) {
  51.       int var3 = var1 > (long)this.rem ? this.rem : (int)var1;
  52.       this.pos += var3;
  53.       this.rem -= var3;
  54.       if (this.rem == 0) {
  55.          this.cleanup();
  56.       }
  57.  
  58.       return (long)var3;
  59.    }
  60.  
  61.    public int available() {
  62.       return this.size;
  63.    }
  64.  
  65.    private void cleanup() {
  66.       this.rem = 0;
  67.       if (this.jzentry != 0L) {
  68.          ZipFile.access$400(this.jzfile, this.jzentry);
  69.          this.jzentry = 0L;
  70.       }
  71.  
  72.    }
  73.  
  74.    public void close() {
  75.       this.cleanup();
  76.    }
  77. }
  78.