public class Archive extends java.lang.Object implements FileArchive
Modifier and Type | Field and Description |
---|---|
protected FileTree |
bundleDir
FileTree handle for bundle storage directory.
|
protected FileTree |
file
File handle for file that contains current archive.
|
protected java.util.zip.ZipFile |
jar
JAR file handle for file that contains current archive.
|
protected int |
revision |
protected int |
subId |
Modifier | Constructor and Description |
---|---|
protected |
Archive(BundleArchiveImpl ba,
FileTree dir,
int rev)
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.lang.String |
checkNativeLibrary(java.lang.String path)
Check for native library in archive.
|
protected void |
downloadArchive(java.io.InputStream is,
java.net.URL source)
Create an Archive based on contents of an InputStream, the archive is saved
as local copy in the specified directory.
|
boolean |
exists(java.lang.String path,
boolean onlyDirs)
Get a BundleResourceStream to named entry inside an Archive.
|
java.util.Enumeration<java.lang.String> |
findResourcesPath(java.lang.String path)
Returns an Enumeration of all the paths (
String objects) to
entries within the bundle whose longest sub-path matches the supplied path
argument. |
BundleGeneration |
getBundleGeneration()
Get bundle id for this archive.
|
BundleResourceStream |
getBundleResourceStream(java.lang.String component)
Get a BundleResourceStream to named entry inside an Archive.
|
byte[] |
getClassBytes(java.lang.String classFile)
Get a byte array containg the contents of named class file from the
archive.
|
protected java.io.File |
getFile()
Returns the File object for this bundle.
|
java.lang.String |
getNativeLibrary(java.lang.String libNameKey)
Get native code library filename.
|
int |
getSubId()
Get sub-archive id for this archive.
|
boolean |
isJar() |
java.util.Set<java.lang.String> |
listDir(java.lang.String path)
Get a BundleResourceStream to named entry inside an Archive.
|
java.lang.Class<?> |
loadClassBytes(java.lang.String name,
java.lang.ClassLoader cl)
Load class bytes into specified class loader for named file from a bundle archive.
|
protected void |
restoreArchive()
Create an Archive based on contents of a saved archive in the specified
directory.
|
protected Archive |
subArchive(java.lang.String path,
int id)
Create a Sub-Archive based on a path to in an already existing Archive.
|
java.lang.String |
toString()
Show file name for archive, if zip show if it is sub archive.
|
protected FileTree bundleDir
protected FileTree file
protected java.util.zip.ZipFile jar
protected int subId
protected int revision
protected Archive(BundleArchiveImpl ba, FileTree dir, int rev)
ba
- BundleArchiveImpl for this archive.dir
- Directory to save data in.rev
- Revision of bundle content (used for updates).protected void downloadArchive(java.io.InputStream is, java.net.URL source) throws java.io.IOException
is
- Jar file data in an InputStream.url
- URL to use to CodeSource.java.io.IOException
protected void restoreArchive() throws java.io.IOException
java.io.IOException
protected Archive subArchive(java.lang.String path, int id) throws java.io.IOException
path
- Path of new Archive inside old Archive.id
- Sub-id of Archive.java.io.FileNotFoundException
- if no such Jar file in archive.java.io.IOException
- if failed to read Jar file.public java.lang.String toString()
toString
in class java.lang.Object
public BundleGeneration getBundleGeneration()
getBundleGeneration
in interface FileArchive
public int getSubId()
getSubId
in interface FileArchive
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 BundleResourceStream getBundleResourceStream(java.lang.String component)
getBundleResourceStream
in interface FileArchive
component
- Entry to get reference to.public java.util.Enumeration<java.lang.String> findResourcesPath(java.lang.String path)
FileArchive
String
objects) to
entries within the bundle whose longest sub-path matches the supplied path
argument.findResourcesPath
in interface FileArchive
public boolean isJar()
public java.lang.Class<?> loadClassBytes(java.lang.String name, java.lang.ClassLoader cl)
FileArchive
loadClassBytes
in interface FileArchive
cl
- Class loader to use for component.public java.util.Set<java.lang.String> listDir(java.lang.String path)
listDir
in interface FileArchive
component
- Entry to get reference to.public boolean exists(java.lang.String path, boolean onlyDirs)
exists
in interface FileArchive
component
- Entry to get reference to.public java.lang.String checkNativeLibrary(java.lang.String path)
checkNativeLibrary
in interface FileArchive
path
- Name of native code file to get.public java.lang.String getNativeLibrary(java.lang.String libNameKey)
getNativeLibrary
in interface FileArchive
libNameKey
- Key for native lib to get.protected java.io.File getFile()