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 / sun / net / www / http / KeepAliveStream.class (.txt) < prev   
Encoding:
Java Class File  |  1979-12-31  |  1.5 KB  |  75 lines

  1. package sun.net.www.http;
  2.  
  3. import java.io.ByteArrayInputStream;
  4. import java.io.DataInputStream;
  5. import java.io.IOException;
  6. import java.io.InputStream;
  7. import sun.net.ProgressData;
  8. import sun.net.ProgressEntry;
  9. import sun.net.www.MeteredStream;
  10.  
  11. public class KeepAliveStream extends MeteredStream {
  12.    // $FF: renamed from: hc sun.net.www.http.HttpClient
  13.    HttpClient field_0;
  14.    boolean hurried;
  15.  
  16.    public KeepAliveStream(InputStream var1, ProgressEntry var2, HttpClient var3) {
  17.       super(var1, var2);
  18.       this.field_0 = var3;
  19.    }
  20.  
  21.    public void close() throws IOException {
  22.       try {
  23.          if (super.expected > super.count) {
  24.             long var1 = (long)(super.expected - super.count);
  25.  
  26.             for(long var3 = 0L; var3 < var1; var3 = ((MeteredStream)this).skip(var1)) {
  27.                var1 -= var3;
  28.             }
  29.          }
  30.  
  31.          if (!super.closed && !this.hurried) {
  32.             HttpClient.finished(this.field_0);
  33.          }
  34.       } finally {
  35.          ProgressData.pdata.unregister(super.te);
  36.          super.in = null;
  37.          this.field_0 = null;
  38.          super.closed = true;
  39.       }
  40.  
  41.    }
  42.  
  43.    public boolean markSupported() {
  44.       return false;
  45.    }
  46.  
  47.    public void mark(int var1) {
  48.    }
  49.  
  50.    public void reset() throws IOException {
  51.       throw new IOException("mark/reset not supported");
  52.    }
  53.  
  54.    public synchronized boolean hurry() {
  55.       try {
  56.          if (!super.closed && super.count < super.expected) {
  57.             if (super.in.available() < super.expected - super.count) {
  58.                return false;
  59.             } else {
  60.                byte[] var1 = new byte[super.expected - super.count];
  61.                DataInputStream var2 = new DataInputStream(super.in);
  62.                var2.readFully(var1);
  63.                super.in = new ByteArrayInputStream(var1);
  64.                this.hurried = true;
  65.                return true;
  66.             }
  67.          } else {
  68.             return false;
  69.          }
  70.       } catch (IOException var3) {
  71.          return false;
  72.       }
  73.    }
  74. }
  75.