Stuart McCulloch | 3fdcd85 | 2011-10-17 10:31:43 +0000 | [diff] [blame] | 1 | package aQute.lib.osgi; |
| 2 | |
| 3 | import java.io.*; |
| 4 | import java.net.*; |
| 5 | |
| 6 | public class URLResource implements Resource { |
| 7 | URL url; |
| 8 | String extra; |
| 9 | |
| 10 | public URLResource(URL url) { |
| 11 | this.url = url; |
| 12 | } |
| 13 | |
| 14 | public InputStream openInputStream() throws IOException { |
| 15 | return url.openStream(); |
| 16 | } |
| 17 | |
| 18 | public String toString() { |
| 19 | return ":" + url.getPath() + ":"; |
| 20 | } |
| 21 | |
| 22 | public void write(OutputStream out) throws Exception { |
| 23 | FileResource.copy(this, out); |
| 24 | } |
| 25 | |
| 26 | public long lastModified() { |
| 27 | return -1; |
| 28 | } |
| 29 | |
| 30 | public String getExtra() { |
| 31 | return extra; |
| 32 | } |
| 33 | |
| 34 | public void setExtra(String extra) { |
| 35 | this.extra = extra; |
| 36 | } |
| 37 | } |