Package jadex.base

Class JarAsDirectory

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<java.io.File>

    public class JarAsDirectory
    extends java.io.File
    A directory-like representation of a jar file.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.Boolean dir  
      protected java.io.File[] entries
      The subentries contained in the entry.
      protected java.util.zip.ZipEntry entry
      The entry.
      protected java.util.Map<java.lang.String,​JarAsDirectory> entryfiles
      The files for the entry paths (cached for easy access).
      protected java.lang.String entrystr  
      protected java.lang.String jarpath
      The path of the jar file.
      protected long lastmodified
      The timestamp of the file.
      protected boolean refresh
      The refresh flag (normally only for root jar file but in remote case also for entries (partial jars).
      • Fields inherited from class java.io.File

        pathSeparator, pathSeparatorChar, separator, separatorChar
    • 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.
      boolean exists()
      Check if the file exists.
      java.lang.String getAbsolutePath()  
      java.util.Map<java.lang.String,​JarAsDirectory> getEntryFiles()
      Get the entryfiles.
      java.lang.String getEntryName()  
      java.io.File getFile​(java.lang.String path)
      Get a file for an entry path.
      java.lang.String getJarPath()
      Get the path to the jar file.
      long getLastModified()
      Get the lastmodified.
      java.util.zip.ZipEntry getZipEntry()
      Get the zip entry, if any (file pointer inside jar file).
      boolean isDirectory()  
      protected boolean isRefresh()
      Test if jar should refresh its content.
      boolean isRoot()
      Test if this is the real jar (not a contained file).
      long lastModified()  
      long length()  
      java.io.File[] listFiles()  
      java.io.File[] listFiles​(java.io.FileFilter filter)  
      java.io.File[] listFiles​(java.io.FilenameFilter filter)  
      boolean refresh()
      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
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • 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:
        isDirectory in class java.io.File
      • listFiles

        public java.io.File[] listFiles​(java.io.FileFilter filter)
        Overrides:
        listFiles in class java.io.File
      • listFiles

        public java.io.File[] listFiles​(java.io.FilenameFilter filter)
        Overrides:
        listFiles in class java.io.File
      • listFiles

        public java.io.File[] listFiles()
        Overrides:
        listFiles in class java.io.File
      • getAbsolutePath

        public java.lang.String getAbsolutePath()
        Overrides:
        getAbsolutePath in class java.io.File
      • lastModified

        public long lastModified()
        Overrides:
        lastModified in class java.io.File
      • length

        public long length()
        Overrides:
        length in class java.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:
        exists in class java.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.