Package gw.fs.jar

Class JarFileDirectoryImpl

    • Field Detail

      • _file

        private java.io.File _file
      • _jarFile

        private java.util.jar.JarFile _jarFile
      • _resources

        private java.util.Map<java.lang.String,​IResource> _resources
      • _childDirs

        private java.util.List<IDirectory> _childDirs
      • _childFiles

        private java.util.List<IFile> _childFiles
    • Constructor Detail

      • JarFileDirectoryImpl

        public JarFileDirectoryImpl​(java.io.File file)
    • Method Detail

      • processJarEntry

        private void processJarEntry​(java.util.jar.JarEntry e)
      • getInputStream

        public java.io.InputStream getInputStream​(java.util.jar.JarEntry entry)
                                           throws java.io.IOException
        Throws:
        java.io.IOException
      • file

        public IFile file​(java.lang.String path)
        Description copied from interface: IDirectory
        Constucts a file given the path. If the path is relative path, it will be constructed based on the current directory
        Specified by:
        file in interface IDirectory
        Parameters:
        path - the path of the file
        Returns:
        The file that is under the directory with the name
      • mkdir

        public boolean mkdir()
                      throws java.io.IOException
        Specified by:
        mkdir in interface IDirectory
        Throws:
        java.io.IOException
      • getParent

        public IDirectory getParent()
        Description copied from interface: IResource
        Gets this file's our directory's parent directory.
        Specified by:
        getParent in interface IResource
        Returns:
        this resource's parent directory
      • getName

        public java.lang.String getName()
        Description copied from interface: IResource
        Gets this file's or directory's name.
        Specified by:
        getName in interface IResource
        Returns:
        this resource's name
      • exists

        public boolean exists()
        Description copied from interface: IResource
        Indicates whether this resource exists.
        Specified by:
        exists in interface IResource
        Returns:
        true if the resource exists
      • delete

        public boolean delete()
                       throws java.io.IOException
        Specified by:
        delete in interface IResource
        Throws:
        java.io.IOException
      • toURI

        public java.net.URI toURI()
        Specified by:
        toURI in interface IResource
      • isChildOf

        public boolean isChildOf​(IDirectory dir)
        Description copied from interface: IResource
        Indicates whether this resource is a direct child of the given directory.
        Specified by:
        isChildOf in interface IResource
        Parameters:
        dir - the directory which would be the parent
        Returns:
        true if this is a direct child of the given directory
      • isDescendantOf

        public boolean isDescendantOf​(IDirectory dir)
        Description copied from interface: IResource
        Indicates whether this resource is a descendant of the given directory.
        Specified by:
        isDescendantOf in interface IResource
        Parameters:
        dir - the directory which would be the ancestor
        Returns:
        true if this is a descendant of the given directory
      • toJavaFile

        public java.io.File toJavaFile()
        Specified by:
        toJavaFile in interface IResource
      • getJarFile

        public java.util.jar.JarFile getJarFile()
      • isInJar

        public boolean isInJar()
        Specified by:
        isInJar in interface IResource
      • create

        public boolean create()
        Specified by:
        create in interface IResource
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hasChildFile

        public boolean hasChildFile​(java.lang.String path)
        Description copied from interface: IDirectory
        Returns true if the given path represents a child of this directory that exists. It's essentially equivalent to calling file(path).exists(), but in cases where this directory caches its list of children and the path represents a direct child of this directory, this method can be optimized to avoid file system access by looking in the list of cached children.
        Specified by:
        hasChildFile in interface IDirectory
        Parameters:
        path - the path of the file
        Returns:
        true if the path represents a file that exists as a child of this directory
      • isAdditional

        public boolean isAdditional()
        Specified by:
        isAdditional in interface IDirectory
        Returns:
        true if this is an "additional" path for resources not copied to the target classpath e.g., config bullshit.