home *** CD-ROM | disk | FTP | other *** search
- package sun.net.www.protocol.systemresource;
-
- import java.io.File;
- import java.io.IOException;
- import java.io.InputStream;
- import java.net.MalformedURLException;
- import java.net.URL;
- import java.net.URLConnection;
- import java.security.Permission;
-
- public class SystemResourceURLConnection extends URLConnection {
- URL delegateUrl;
- URLConnection delegateConnection;
-
- SystemResourceURLConnection(URL var1) throws MalformedURLException, IOException {
- super(var1);
- this.delegateUrl = this.makeDelegateUrl(var1);
- this.delegateConnection = this.delegateUrl.openConnection();
- }
-
- private URL makeDelegateUrl(URL var1) throws MalformedURLException {
- boolean var2 = false;
- String var3 = var1.getFile();
- if (var3.startsWith("/FILE")) {
- var2 = true;
- }
-
- int var4 = var2 ? 5 : 4;
- int var5 = var3.lastIndexOf("/+/");
- if (var5 < 0) {
- throw new MalformedURLException("no /+/ found in URL");
- } else {
- if (var2) {
- var3 = "file:" + var3.substring(var4, var5) + File.separatorChar + var3.substring(var5 + 3, var3.length());
- } else {
- var3 = "jar:file:" + var3.substring(var4, var5) + "!/" + var3.substring(var5 + 3, var3.length());
- }
-
- return new URL(var3);
- }
- }
-
- public void connect() throws IOException {
- this.delegateConnection.connect();
- }
-
- public Object getContent() throws IOException {
- return this.delegateConnection.getContent();
- }
-
- public String getContentType() {
- return this.delegateConnection.getContentType();
- }
-
- public InputStream getInputStream() throws IOException {
- return this.delegateConnection.getInputStream();
- }
-
- public String getHeaderField(String var1) {
- return this.delegateConnection.getHeaderField(var1);
- }
-
- public Permission getPermission() throws IOException {
- return this.delegateConnection.getPermission();
- }
- }
-