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 / io / SequenceInputStream.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  1.4 KB  |  98 lines

  1. package java.io;
  2.  
  3. import java.util.Enumeration;
  4. import java.util.Vector;
  5.  
  6. public class SequenceInputStream extends InputStream {
  7.    // $FF: renamed from: e java.util.Enumeration
  8.    Enumeration field_0;
  9.    // $FF: renamed from: in java.io.InputStream
  10.    InputStream field_1;
  11.  
  12.    public SequenceInputStream(Enumeration var1) {
  13.       this.field_0 = var1;
  14.  
  15.       try {
  16.          this.nextStream();
  17.       } catch (IOException var3) {
  18.          throw new Error("panic");
  19.       }
  20.    }
  21.  
  22.    public SequenceInputStream(InputStream var1, InputStream var2) {
  23.       Vector var3 = new Vector(2);
  24.       var3.addElement(var1);
  25.       var3.addElement(var2);
  26.       this.field_0 = var3.elements();
  27.  
  28.       try {
  29.          this.nextStream();
  30.       } catch (IOException var5) {
  31.          throw new Error("panic");
  32.       }
  33.    }
  34.  
  35.    final void nextStream() throws IOException {
  36.       if (this.field_1 != null) {
  37.          this.field_1.close();
  38.       }
  39.  
  40.       if (this.field_0.hasMoreElements()) {
  41.          this.field_1 = (InputStream)this.field_0.nextElement();
  42.          if (this.field_1 == null) {
  43.             throw new NullPointerException();
  44.          }
  45.       } else {
  46.          this.field_1 = null;
  47.       }
  48.  
  49.    }
  50.  
  51.    public int available() throws IOException {
  52.       return this.field_1 == null ? 0 : this.field_1.available();
  53.    }
  54.  
  55.    public int read() throws IOException {
  56.       if (this.field_1 == null) {
  57.          return -1;
  58.       } else {
  59.          int var1 = this.field_1.read();
  60.          if (var1 == -1) {
  61.             this.nextStream();
  62.             return this.read();
  63.          } else {
  64.             return var1;
  65.          }
  66.       }
  67.    }
  68.  
  69.    public int read(byte[] var1, int var2, int var3) throws IOException {
  70.       if (this.field_1 == null) {
  71.          return -1;
  72.       } else if (var1 == null) {
  73.          throw new NullPointerException();
  74.       } else if (var2 >= 0 && var2 <= var1.length && var3 >= 0 && var2 + var3 <= var1.length && var2 + var3 >= 0) {
  75.          if (var3 == 0) {
  76.             return 0;
  77.          } else {
  78.             int var4 = this.field_1.read(var1, var2, var3);
  79.             if (var4 <= 0) {
  80.                this.nextStream();
  81.                return this.read(var1, var2, var3);
  82.             } else {
  83.                return var4;
  84.             }
  85.          }
  86.       } else {
  87.          throw new IndexOutOfBoundsException();
  88.       }
  89.    }
  90.  
  91.    public void close() throws IOException {
  92.       do {
  93.          this.nextStream();
  94.       } while(this.field_1 != null);
  95.  
  96.    }
  97. }
  98.