blob: 1734fc9933d1f043e8c3317780e4b86fe671d2f9 [file] [log] [blame]
Stuart McCulloch39cc9ac2012-07-16 13:43:38 +00001package aQute.bnd.osgi;
Stuart McCullochbb014372012-06-07 21:57:32 +00002
3import java.io.*;
4
5public class JarResource extends WriteResource {
6 Jar jar;
7 long size = -1;
8
9 public JarResource(Jar jar) {
10 this.jar = jar;
11 }
12
Stuart McCulloch55d4dfe2012-08-07 10:57:21 +000013 @Override
Stuart McCullochbb014372012-06-07 21:57:32 +000014 public long lastModified() {
15 return jar.lastModified();
16 }
17
Stuart McCulloch55d4dfe2012-08-07 10:57:21 +000018 @Override
Stuart McCullochbb014372012-06-07 21:57:32 +000019 public void write(OutputStream out) throws Exception {
20 try {
21 jar.write(out);
Stuart McCulloch2286f232012-06-15 13:27:53 +000022 }
23 catch (Exception e) {
Stuart McCullochbb014372012-06-07 21:57:32 +000024 e.printStackTrace();
25 throw e;
26 }
27 }
28
29 public Jar getJar() {
30 return jar;
31 }
32
Stuart McCulloch55d4dfe2012-08-07 10:57:21 +000033 @Override
Stuart McCullochbb014372012-06-07 21:57:32 +000034 public String toString() {
35 return ":" + jar.getName() + ":";
36 }
37
38}