home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1999 April / DPPCPRO0499.ISO / April / Notes / 50b2wic.exe / DATA1.CAB / NotesProgramFilesJavaSupport / rt.jar / java / io / SequenceInputStream.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-04-23  |  1.5 KB  |  84 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 var2) {
  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 var4) {
  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.       this.field_1 = this.field_0.hasMoreElements() ? (InputStream)this.field_0.nextElement() : null;
  41.    }
  42.  
  43.    public int available() throws IOException {
  44.       return this.field_1 == null ? 0 : this.field_1.available();
  45.    }
  46.  
  47.    public int read() throws IOException {
  48.       if (this.field_1 == null) {
  49.          return -1;
  50.       } else {
  51.          int var1 = this.field_1.read();
  52.          if (var1 == -1) {
  53.             this.nextStream();
  54.             return this.read();
  55.          } else {
  56.             return var1;
  57.          }
  58.       }
  59.    }
  60.  
  61.    public int read(byte[] var1, int var2, int var3) throws IOException {
  62.       if (this.field_1 == null) {
  63.          return -1;
  64.       } else if (var3 == 0) {
  65.          return 0;
  66.       } else {
  67.          int var4 = this.field_1.read(var1, var2, var3);
  68.          if (var4 <= 0) {
  69.             this.nextStream();
  70.             return this.read(var1, var2, var3);
  71.          } else {
  72.             return var4;
  73.          }
  74.       }
  75.    }
  76.  
  77.    public void close() throws IOException {
  78.       do {
  79.          this.nextStream();
  80.       } while(this.field_1 != null);
  81.  
  82.    }
  83. }
  84.