Package jadex.base
Class JarAsDirectory
- java.lang.Object
-
- java.io.File
-
- jadex.base.JarAsDirectory
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<java.io.File>
public class JarAsDirectory extends java.io.FileA directory-like representation of a jar file.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.Booleandirprotected java.io.File[]entriesThe subentries contained in the entry.protected java.util.zip.ZipEntryentryThe entry.protected java.util.Map<java.lang.String,JarAsDirectory>entryfilesThe files for the entry paths (cached for easy access).protected java.lang.Stringentrystrprotected java.lang.StringjarpathThe path of the jar file.protected longlastmodifiedThe timestamp of the file.protected booleanrefreshThe refresh flag (normally only for root jar file but in remote case also for entries (partial jars).
-
Constructor Summary
Constructors Constructor Description JarAsDirectory(java.lang.String jarpath)Create a directory representation of a jar file.JarAsDirectory(java.lang.String jarpath, java.lang.String entrystr, boolean dir, boolean refresh)Create a directory representation of a jar file entry.JarAsDirectory(java.lang.String jarpath, java.util.zip.ZipEntry entry)Create a directory representation of a jar file entry.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MultiCollection<java.lang.String,java.util.zip.ZipEntry>createEntries()java.io.File[]createFiles(java.lang.String key, MultiCollection<java.lang.String,java.util.zip.ZipEntry> entries)Create the files for an entry.booleanexists()Check if the file exists.java.lang.StringgetAbsolutePath()java.util.Map<java.lang.String,JarAsDirectory>getEntryFiles()Get the entryfiles.java.lang.StringgetEntryName()java.io.FilegetFile(java.lang.String path)Get a file for an entry path.java.lang.StringgetJarPath()Get the path to the jar file.longgetLastModified()Get the lastmodified.java.util.zip.ZipEntrygetZipEntry()Get the zip entry, if any (file pointer inside jar file).booleanisDirectory()protected booleanisRefresh()Test if jar should refresh its content.booleanisRoot()Test if this is the real jar (not a contained file).longlastModified()longlength()java.io.File[]listFiles()java.io.File[]listFiles(java.io.FileFilter filter)java.io.File[]listFiles(java.io.FilenameFilter filter)booleanrefresh()Refresh the jar entries.-
Methods inherited from class java.io.File
canExecute, canRead, canWrite, compareTo, createNewFile, createTempFile, createTempFile, delete, deleteOnExit, equals, getAbsoluteFile, getCanonicalFile, getCanonicalPath, getFreeSpace, getName, getParent, getParentFile, getPath, getTotalSpace, getUsableSpace, hashCode, isAbsolute, isFile, isHidden, list, list, listRoots, mkdir, mkdirs, renameTo, setExecutable, setExecutable, setLastModified, setReadable, setReadable, setReadOnly, setWritable, setWritable, toPath, toString, toURI, toURL
-
-
-
-
Field Detail
-
jarpath
protected java.lang.String jarpath
The path of the jar file.
-
lastmodified
protected long lastmodified
The timestamp of the file.
-
entry
protected java.util.zip.ZipEntry entry
The entry.
-
entrystr
protected java.lang.String entrystr
-
dir
protected java.lang.Boolean dir
-
entries
protected java.io.File[] entries
The subentries contained in the entry.
-
entryfiles
protected java.util.Map<java.lang.String,JarAsDirectory> entryfiles
The files for the entry paths (cached for easy access).
-
refresh
protected boolean refresh
The refresh flag (normally only for root jar file but in remote case also for entries (partial jars).
-
-
Constructor Detail
-
JarAsDirectory
public JarAsDirectory(java.lang.String jarpath)
Create a directory representation of a jar file.
-
JarAsDirectory
public JarAsDirectory(java.lang.String jarpath, java.lang.String entrystr, boolean dir, boolean refresh)Create a directory representation of a jar file entry.
-
JarAsDirectory
public JarAsDirectory(java.lang.String jarpath, java.util.zip.ZipEntry entry)Create a directory representation of a jar file entry.
-
-
Method Detail
-
isDirectory
public boolean isDirectory()
- Overrides:
isDirectoryin classjava.io.File
-
listFiles
public java.io.File[] listFiles(java.io.FileFilter filter)
- Overrides:
listFilesin classjava.io.File
-
listFiles
public java.io.File[] listFiles(java.io.FilenameFilter filter)
- Overrides:
listFilesin classjava.io.File
-
listFiles
public java.io.File[] listFiles()
- Overrides:
listFilesin classjava.io.File
-
getAbsolutePath
public java.lang.String getAbsolutePath()
- Overrides:
getAbsolutePathin classjava.io.File
-
lastModified
public long lastModified()
- Overrides:
lastModifiedin classjava.io.File
-
length
public long length()
- Overrides:
lengthin classjava.io.File
-
refresh
public boolean refresh()
Refresh the jar entries.
-
createEntries
public MultiCollection<java.lang.String,java.util.zip.ZipEntry> createEntries()
-
exists
public boolean exists()
Check if the file exists.- Overrides:
existsin classjava.io.File
-
createFiles
public java.io.File[] createFiles(java.lang.String key, MultiCollection<java.lang.String,java.util.zip.ZipEntry> entries)Create the files for an entry. Recursive implementation for directory entries.
-
getJarPath
public java.lang.String getJarPath()
Get the path to the jar file.
-
getZipEntry
public java.util.zip.ZipEntry getZipEntry()
Get the zip entry, if any (file pointer inside jar file). The jar file itself (root) has no entry (i.e. entry=null).
-
getFile
public java.io.File getFile(java.lang.String path)
Get a file for an entry path.
-
getEntryFiles
public java.util.Map<java.lang.String,JarAsDirectory> getEntryFiles()
Get the entryfiles.- Returns:
- the entryfiles.
-
isRoot
public boolean isRoot()
Test if this is the real jar (not a contained file).
-
getLastModified
public long getLastModified()
Get the lastmodified.- Returns:
- the lastmodified.
-
getEntryName
public java.lang.String getEntryName()
-
isRefresh
protected boolean isRefresh()
Test if jar should refresh its content. Normally only root jar reads entries and entries already contain their children.
-
-