org.knopflerfish.framework.bundlestorage.file
public class Archive extends java.lang.Object implements FileArchive
Constructor and Description |
---|
Archive(java.io.File dir,
int rev,
java.io.InputStream is,
java.net.URL source,
java.lang.String location,
boolean checkSigned)
Create an Archive based on contents of an InputStream,
the archive is saved as local copy in the specified
directory.
|
Modifier and Type | Method and Description |
---|---|
java.util.Enumeration |
findResourcesPath(java.lang.String path) |
java.lang.String |
getAttribute(java.lang.String key)
Get an attribute from the manifest of the archive.
|
byte[] |
getClassBytes(java.lang.String classFile)
Get a byte array containg the contents of named class file from
the archive.
|
java.io.InputStream |
getInputStream(java.lang.String component)
Get an InputStream to named entry inside an Archive.
|
java.util.jar.Manifest |
getManifest()
Get manifest for this archive.
|
FileArchive |
getSubArchive(java.lang.String path)
Get an Archive handle to a named Jar file within this archive.
|
void |
removeCertificates() |
void |
saveCertificates() |
java.lang.String |
toString()
Show file name for archive, if zip show if it is sub archive.
|
public Archive(java.io.File dir, int rev, java.io.InputStream is, java.net.URL source, java.lang.String location, boolean checkSigned) throws java.io.IOException, BundleException
storage
- BundleStorageImpl for this archive.dir
- Directory to save data in.rev
- Revision of bundle content (used for updates).is
- Jar file data in an InputStream.url
- URL to use to CodeSource.location
- Location for archivecheckSigned
- Check signed bundlesjava.io.IOException
BundleException
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getAttribute(java.lang.String key)
getAttribute
in interface FileArchive
key
- Name of attribute to get.public byte[] getClassBytes(java.lang.String classFile) throws java.io.IOException
getClassBytes
in interface FileArchive
Class
- File to get.java.io.IOException
- if failed to read jar entry.public java.util.Enumeration findResourcesPath(java.lang.String path)
findResourcesPath
in interface FileArchive
public FileArchive getSubArchive(java.lang.String path) throws java.io.IOException
getSubArchive
in interface FileArchive
path
- Name of Jar file to get.java.io.FileNotFoundException
- if no such Jar file in archive.java.io.IOException
- if failed to read Jar file.public java.io.InputStream getInputStream(java.lang.String component)
FileArchive
getInputStream
in interface FileArchive
component
- Entry to get reference to.public java.util.jar.Manifest getManifest()
FileArchive
getManifest
in interface FileArchive
public void saveCertificates() throws java.io.IOException
java.io.IOException
public void removeCertificates()