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 / protocol / doc / DocURLConnection.class (.txt) next >
Encoding:
Java Class File  |  1997-07-08  |  2.0 KB  |  57 lines

  1. package sun.net.www.protocol.doc;
  2.  
  3. import java.io.BufferedInputStream;
  4. import java.io.File;
  5. import java.io.FileInputStream;
  6. import java.io.IOException;
  7. import java.io.InputStream;
  8. import java.net.URL;
  9. import sun.net.www.MessageHeader;
  10. import sun.net.www.MimeEntry;
  11. import sun.net.www.MimeTable;
  12. import sun.net.www.URLConnection;
  13.  
  14. public class DocURLConnection extends URLConnection {
  15.    // $FF: renamed from: is java.io.InputStream
  16.    InputStream field_0;
  17.    static String installDirectory = System.getProperty("hotjava.home");
  18.  
  19.    DocURLConnection(URL var1) {
  20.       super(var1);
  21.    }
  22.  
  23.    public void connect() throws IOException {
  24.       String var1 = installDirectory + super.url.getFile();
  25.       MessageHeader var2 = new MessageHeader();
  26.       MimeTable var3 = MimeTable.getDefaultTable();
  27.       MimeEntry var4 = var3.findByFileName(var1);
  28.       if (var4 != null) {
  29.          var2.add("content-type", var4.getType());
  30.       }
  31.  
  32.       ((URLConnection)this).setProperties(var2);
  33.       File var5 = new File(var1);
  34.       if (var5.exists()) {
  35.          var2.add("Content-length", String.valueOf(var5.length()));
  36.       }
  37.  
  38.       this.field_0 = new BufferedInputStream(new FileInputStream(var1.replace('/', File.separatorChar)));
  39.       super.connected = true;
  40.    }
  41.  
  42.    public synchronized InputStream getInputStream() throws IOException {
  43.       if (!super.connected) {
  44.          this.connect();
  45.       }
  46.  
  47.       return this.field_0;
  48.    }
  49.  
  50.    static {
  51.       if (installDirectory == null) {
  52.          installDirectory = "/usr/local/hotjava";
  53.       }
  54.  
  55.    }
  56. }
  57.