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 | |
Stuart McCulloch | 55d4dfe | 2012-08-07 10:57:21 +0000 | [diff] [blame^] | 13 | @Override |
Stuart McCulloch | bb01437 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 14 | public long lastModified() { |
| 15 | return jar.lastModified(); |
| 16 | } |
| 17 | |
Stuart McCulloch | 55d4dfe | 2012-08-07 10:57:21 +0000 | [diff] [blame^] | 18 | @Override |
Stuart McCulloch | bb01437 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 19 | public void write(OutputStream out) throws Exception { |
| 20 | try { |
| 21 | jar.write(out); |
Stuart McCulloch | 2286f23 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 22 | } |
| 23 | catch (Exception e) { |
Stuart McCulloch | bb01437 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 24 | e.printStackTrace(); |
| 25 | throw e; |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | public Jar getJar() { |
| 30 | return jar; |
| 31 | } |
| 32 | |
Stuart McCulloch | 55d4dfe | 2012-08-07 10:57:21 +0000 | [diff] [blame^] | 33 | @Override |
Stuart McCulloch | bb01437 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 34 | public String toString() { |
| 35 | return ":" + jar.getName() + ":"; |
| 36 | } |
| 37 | |
| 38 | } |