1 11 12 package org.eclipse.osgi.baseadaptor.bundlefile; 13 14 import java.io.*; 15 import java.net.MalformedURLException ; 16 import java.net.URL ; 17 18 23 public class FileBundleEntry extends BundleEntry { 24 27 private File file; 28 31 String name; 32 33 38 FileBundleEntry(File file, String name) { 39 this.file = file; 40 this.name = name; 41 } 42 43 49 public InputStream getInputStream() throws IOException { 50 return BundleFile.secureAction.getFileInputStream(file); 51 } 52 53 58 public long getSize() { 59 return BundleFile.secureAction.length(file); 60 } 61 62 67 public String getName() { 68 return (name); 69 } 70 71 78 public long getTime() { 79 return BundleFile.secureAction.lastModified(file); 80 } 81 82 public URL getLocalURL() { 83 return getFileURL(); 84 } 85 86 public URL getFileURL() { 87 try { 88 return file.toURL(); 89 } catch (MalformedURLException e) { 90 return null; 91 } 92 } 93 } 94 | Popular Tags |