Stuart McCulloch | 39cc9ac | 2012-07-16 13:43:38 +0000 | [diff] [blame] | 1 | package aQute.bnd.osgi; |
Stuart McCulloch | bb01437 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 2 | |
| 3 | import java.io.*; |
| 4 | |
| 5 | public class JarResource extends WriteResource { |
| 6 | Jar jar; |
| 7 | long size = -1; |
| 8 | |
| 9 | public JarResource(Jar jar) { |
| 10 | this.jar = jar; |
| 11 | } |
| 12 | |
| 13 | public long lastModified() { |
| 14 | return jar.lastModified(); |
| 15 | } |
| 16 | |
| 17 | public void write(OutputStream out) throws Exception { |
| 18 | try { |
| 19 | jar.write(out); |
Stuart McCulloch | 2286f23 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 20 | } |
| 21 | catch (Exception e) { |
Stuart McCulloch | bb01437 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 22 | e.printStackTrace(); |
| 23 | throw e; |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | public Jar getJar() { |
| 28 | return jar; |
| 29 | } |
| 30 | |
| 31 | public String toString() { |
| 32 | return ":" + jar.getName() + ":"; |
| 33 | } |
| 34 | |
| 35 | } |