home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / VPage / Java.bin / CLASSES.ZIP / sun / net / www / http / KeepAliveStream.class (.txt) < prev   
Encoding:
Java Class File  |  1997-07-08  |  1.7 KB  |  69 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.             ((MeteredStream)this).skip((long)(super.expected - super.count));
  25.          }
  26.  
  27.          if (!super.closed && !this.hurried) {
  28.             HttpClient.finished(this.field_0);
  29.          }
  30.       } finally {
  31.          ProgressData.pdata.unregister(super.te);
  32.          super.closed = true;
  33.       }
  34.  
  35.    }
  36.  
  37.    public boolean markSupported() {
  38.       return false;
  39.    }
  40.  
  41.    public void mark(int var1) {
  42.    }
  43.  
  44.    public void reset() throws IOException {
  45.       throw new IOException("mark/reset not supported");
  46.    }
  47.  
  48.    public synchronized boolean hurry() {
  49.       try {
  50.          if (!super.closed && super.count < super.expected) {
  51.             if (super.in.available() < super.expected - super.count) {
  52.                return false;
  53.             } else {
  54.                byte[] var1 = new byte[super.expected - super.count];
  55.                DataInputStream var2 = new DataInputStream(super.in);
  56.                var2.readFully(var1);
  57.                super.in = new ByteArrayInputStream(var1);
  58.                this.hurried = true;
  59.                return true;
  60.             }
  61.          } else {
  62.             return false;
  63.          }
  64.       } catch (IOException var3) {
  65.          return false;
  66.       }
  67.    }
  68. }
  69.