blob: f43ac912276499c09fe406a3470264d0370f2e52 [file] [log] [blame]
Stuart McCulloch5ec302d2008-12-04 07:58:07 +00001/* Copyright 2006 aQute SARL
2 * Licensed under the Apache License, Version 2.0, see http://www.apache.org/licenses/LICENSE-2.0 */
3package aQute.lib.osgi;
4
5import java.io.*;
6import java.net.*;
7
8public 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}