aboutsummaryrefslogtreecommitdiff
path: root/src/org/eclipse/jdt/internal/jarinjarloader/RsrcURLConnection.java
blob: 9cc10e7a1c3958a292509c61393c73677d7ac233 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*    */ package org.eclipse.jdt.internal.jarinjarloader;
/*    */ 
/*    */ import java.io.IOException;
/*    */ import java.io.InputStream;
/*    */ import java.net.MalformedURLException;
/*    */ import java.net.URL;
/*    */ import java.net.URLConnection;
/*    */ import java.net.URLDecoder;
/*    */ 
/*    */ public class RsrcURLConnection extends URLConnection
/*    */ {
/*    */   private ClassLoader classLoader;
/*    */ 
/*    */   public RsrcURLConnection(URL url, ClassLoader classLoader)
/*    */   {
/* 34 */     super(url);
/* 35 */     this.classLoader = classLoader;
/*    */   }
/*    */ 
/*    */   public void connect() throws IOException {
/*    */   }
/*    */ 
/*    */   public InputStream getInputStream() throws IOException {
/* 42 */     String file = URLDecoder.decode(this.url.getFile(), "UTF-8");
/* 43 */     InputStream result = this.classLoader.getResourceAsStream(file);
/* 44 */     if (result == null) {
/* 45 */       throw new MalformedURLException("Could not open InputStream for URL '" + this.url + "'");
/*    */     }
/* 47 */     return result;
/*    */   }
/*    */ }

/* Location:           Modulus.jar
 * Qualified Name:     org.eclipse.jdt.internal.jarinjarloader.RsrcURLConnection
 * JD-Core Version:    0.6.2
 */