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 / net / JarURLConnection.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  1.7 KB  |  69 lines

  1. package java.net;
  2.  
  3. import java.io.IOException;
  4. import java.security.cert.Certificate;
  5. import java.util.jar.Attributes;
  6. import java.util.jar.JarEntry;
  7. import java.util.jar.JarFile;
  8. import java.util.jar.Manifest;
  9.  
  10. public abstract class JarURLConnection extends URLConnection {
  11.    private URL jarFileURL;
  12.    private String entryName;
  13.    protected URLConnection jarFileURLConnection;
  14.  
  15.    protected JarURLConnection(URL var1) throws MalformedURLException {
  16.       super(var1);
  17.       this.parseSpecs(var1);
  18.    }
  19.  
  20.    private void parseSpecs(URL var1) throws MalformedURLException {
  21.       String var2 = var1.getFile();
  22.       int var3 = var2.indexOf(33);
  23.       if (var3 == -1) {
  24.          throw new MalformedURLException("no ! found in url spec:" + var2);
  25.       } else {
  26.          this.jarFileURL = new URL(var2.substring(0, var3++));
  27.          this.entryName = null;
  28.          ++var3;
  29.          if (var3 != var2.length()) {
  30.             this.entryName = var2.substring(var3, var2.length());
  31.          }
  32.  
  33.       }
  34.    }
  35.  
  36.    public URL getJarFileURL() {
  37.       return this.jarFileURL;
  38.    }
  39.  
  40.    public String getEntryName() {
  41.       return this.entryName;
  42.    }
  43.  
  44.    public abstract JarFile getJarFile() throws IOException;
  45.  
  46.    public Manifest getManifest() throws IOException {
  47.       return this.getJarFile().getManifest();
  48.    }
  49.  
  50.    public JarEntry getJarEntry() throws IOException {
  51.       return this.getJarFile().getJarEntry(this.entryName);
  52.    }
  53.  
  54.    public Attributes getAttributes() throws IOException {
  55.       JarEntry var1 = this.getJarEntry();
  56.       return var1 != null ? var1.getAttributes() : null;
  57.    }
  58.  
  59.    public Attributes getMainAttributes() throws IOException {
  60.       Manifest var1 = this.getManifest();
  61.       return var1 != null ? var1.getMainAttributes() : null;
  62.    }
  63.  
  64.    public Certificate[] getCertificates() throws IOException {
  65.       JarEntry var1 = this.getJarEntry();
  66.       return var1 != null ? var1.getCertificates() : null;
  67.    }
  68. }
  69.