Stuart McCulloch | 5ec302d | 2008-12-04 07:58:07 +0000 | [diff] [blame] | 1 | /* Copyright 2006 aQute SARL |
| 2 | * Licensed under the Apache License, Version 2.0, see http://www.apache.org/licenses/LICENSE-2.0 */ |
| 3 | package aQute.lib.osgi; |
| 4 | |
| 5 | import java.io.*; |
| 6 | import java.net.*; |
| 7 | |
| 8 | public class URLResource implements Resource { |
| 9 | URL url; |
| 10 | String extra; |
| 11 | |
| 12 | public URLResource(URL url) { |
| 13 | this.url = url; |
| 14 | } |
| 15 | |
| 16 | public InputStream openInputStream() throws IOException { |
| 17 | return url.openStream(); |
| 18 | } |
| 19 | |
| 20 | public String toString() { |
| 21 | return ":" + url.getPath() + ":"; |
| 22 | } |
| 23 | |
| 24 | public void write(OutputStream out) throws IOException { |
| 25 | FileResource.copy(this, out); |
| 26 | } |
| 27 | |
| 28 | public long lastModified() { |
| 29 | return -1; |
| 30 | } |
| 31 | |
| 32 | public String getExtra() { |
| 33 | return extra; |
| 34 | } |
| 35 | |
| 36 | public void setExtra(String extra) { |
| 37 | this.extra = extra; |
| 38 | } |
| 39 | } |