1 package org.jicengine.io; 2 3 import java.io.*; 4 import java.net.URL ; 5 6 17 18 public class UrlResource extends AbstractResource implements UrlReadable { 19 20 private URL url; 21 22 public UrlResource(URL url) 23 { 24 super(url.toString()); 25 this.url = url; 26 } 27 28 public UrlResource(String url) throws java.net.MalformedURLException 29 { 30 this(new URL (url)); 31 } 32 33 public URL getUrl() 34 { 35 return this.url; 36 } 37 38 public InputStream getInputStream() throws java.io.IOException 39 { 40 return getUrl().openStream(); 41 } 42 43 public Resource getResource(String relativePath) throws IOException 44 { 45 return new UrlResource(new URL (getUrl(), relativePath)); 46 } 47 } 48 | Popular Tags |