< prev index next >

src/java.base/share/classes/sun/net/www/protocol/jar/JarURLConnection.java

Print this page




  72 
  73     /* the jar file corresponding to this connection */
  74     private JarFile jarFile;
  75 
  76     /* the content type for this connection */
  77     private String contentType;
  78 
  79     public JarURLConnection(URL url, Handler handler)
  80     throws MalformedURLException, IOException {
  81         super(url);
  82 
  83         jarFileURL = getJarFileURL();
  84         jarFileURLConnection = jarFileURL.openConnection();
  85         // whether, or not, the embedded URL should use the cache will depend
  86         // on this instance's cache value
  87         jarFileURLConnection.setUseCaches(useCaches);
  88         entryName = getEntryName();
  89     }
  90 
  91     public JarFile getJarFile() throws IOException {

  92         connect();
  93         return jarFile;







  94     }
  95 
  96     public JarEntry getJarEntry() throws IOException {
  97         connect();
  98         return jarEntry;
  99     }
 100 
 101     public Permission getPermission() throws IOException {
 102         return jarFileURLConnection.getPermission();
 103     }
 104 
 105     class JarURLInputStream extends java.io.FilterInputStream {
 106         JarURLInputStream (InputStream src) {
 107             super (src);
 108         }
 109         public void close () throws IOException {
 110             try {
 111                 super.close();
 112             } finally {
 113                 if (!getUseCaches()) {




  72 
  73     /* the jar file corresponding to this connection */
  74     private JarFile jarFile;
  75 
  76     /* the content type for this connection */
  77     private String contentType;
  78 
  79     public JarURLConnection(URL url, Handler handler)
  80     throws MalformedURLException, IOException {
  81         super(url);
  82 
  83         jarFileURL = getJarFileURL();
  84         jarFileURLConnection = jarFileURL.openConnection();
  85         // whether, or not, the embedded URL should use the cache will depend
  86         // on this instance's cache value
  87         jarFileURLConnection.setUseCaches(useCaches);
  88         entryName = getEntryName();
  89     }
  90 
  91     public JarFile getJarFile() throws IOException {
  92         try {
  93             connect();
  94             return jarFile;
  95         } catch (IOException e) {
  96             if (jarFile != null) {
  97                 return jarFile;
  98             } else {
  99                 throw e;
 100             }
 101         }
 102     }
 103 
 104     public JarEntry getJarEntry() throws IOException {
 105         connect();
 106         return jarEntry;
 107     }
 108 
 109     public Permission getPermission() throws IOException {
 110         return jarFileURLConnection.getPermission();
 111     }
 112 
 113     class JarURLInputStream extends java.io.FilterInputStream {
 114         JarURLInputStream (InputStream src) {
 115             super (src);
 116         }
 117         public void close () throws IOException {
 118             try {
 119                 super.close();
 120             } finally {
 121                 if (!getUseCaches()) {


< prev index next >