Class GridFile

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

    public class GridFile
    extends java.io.File
    Subclass of File to iterate through directories and files in a grid
    Author:
    Bela Ban, Marko Luksa
    See Also:
    Serialized Form
    • Method Detail

      • getName

        public java.lang.String getName()
        Overrides:
        getName in class java.io.File
      • getPath

        public java.lang.String getPath()
        Returns path of this file. To avoid issues arising from file separator differences between different operative systems, the path returned always uses Unix-like path separator, '/' character. Any client code calling this method should bear that if disecting the path.
        Overrides:
        getPath in class java.io.File
        Returns:
        String containing path of file.
      • getAbsolutePath

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

        public java.io.File getAbsoluteFile()
        Overrides:
        getAbsoluteFile in class java.io.File
      • getCanonicalPath

        public java.lang.String getCanonicalPath()
                                          throws java.io.IOException
        Overrides:
        getCanonicalPath in class java.io.File
        Throws:
        java.io.IOException
      • getCanonicalFile

        public java.io.File getCanonicalFile()
                                      throws java.io.IOException
        Overrides:
        getCanonicalFile in class java.io.File
        Throws:
        java.io.IOException
      • isAbsolute

        public boolean isAbsolute()
        Overrides:
        isAbsolute in class java.io.File
      • renameTo

        public boolean renameTo​(java.io.File dest)
        Overrides:
        renameTo in class java.io.File
      • deleteOnExit

        public void deleteOnExit()
        Overrides:
        deleteOnExit in class java.io.File
      • length

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

        public int getChunkSize()
        Guaranteed to be a power of two
      • createNewFile

        public boolean createNewFile()
                              throws java.io.IOException
        Overrides:
        createNewFile in class java.io.File
        Throws:
        java.io.IOException
      • delete

        public boolean delete()
        Overrides:
        delete in class java.io.File
      • mkdir

        public boolean mkdir()
        Overrides:
        mkdir in class java.io.File
      • mkdirs

        public boolean mkdirs()
        Overrides:
        mkdirs in class java.io.File
      • exists

        public boolean exists()
        Overrides:
        exists in class java.io.File
      • getParent

        public java.lang.String getParent()
        Overrides:
        getParent in class java.io.File
      • getParentFile

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

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

        public boolean setLastModified​(long time)
        Overrides:
        setLastModified in class java.io.File
      • list

        public java.lang.String[] list()
        Overrides:
        list in class java.io.File
      • list

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

        public java.io.File[] listFiles()
        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​(java.io.FileFilter filter)
        Overrides:
        listFiles in class java.io.File
      • isDirectory

        public boolean isDirectory()
        Overrides:
        isDirectory in class java.io.File
      • isFile

        public boolean isFile()
        Overrides:
        isFile in class java.io.File
      • initChunkSizeFromMetadata

        protected void initChunkSizeFromMetadata()
      • _listFiles

        protected java.io.File[] _listFiles​(java.lang.Object filter)
      • _list

        protected java.lang.String[] _list​(java.lang.Object filter)
      • isChildOf

        protected static boolean isChildOf​(java.lang.String parent,
                                           java.lang.String child)
        Verifies whether child is a child (dir or file) of parent
        Parameters:
        parent -
        child -
        Returns:
        True if child is a child, false otherwise
      • filename

        protected static java.lang.String filename​(java.lang.String fullPath)
      • checkParentDirs

        protected boolean checkParentDirs​(java.lang.String path,
                                          boolean createIfAbsent)
                                   throws java.io.IOException
        Checks whether the parent directories are present (and are directories). If createIfAbsent is true, creates missing dirs
        Parameters:
        path -
        createIfAbsent -
        Returns:
        Throws:
        java.io.IOException
      • equals

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

        public boolean canRead()
        Overrides:
        canRead in class java.io.File
      • canWrite

        public boolean canWrite()
        Overrides:
        canWrite in class java.io.File
      • isHidden

        public boolean isHidden()
        Overrides:
        isHidden in class java.io.File
      • canExecute

        public boolean canExecute()
        Overrides:
        canExecute in class java.io.File
      • compareTo

        public int compareTo​(java.io.File file)
        Specified by:
        compareTo in interface java.lang.Comparable<java.io.File>
        Overrides:
        compareTo in class java.io.File
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.io.File
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.io.File
      • toURL

        public java.net.URL toURL()
                           throws java.net.MalformedURLException
        Overrides:
        toURL in class java.io.File
        Throws:
        java.net.MalformedURLException
      • toURI

        public java.net.URI toURI()
        Overrides:
        toURI in class java.io.File
      • setReadOnly

        public boolean setReadOnly()
        Overrides:
        setReadOnly in class java.io.File
      • setWritable

        public boolean setWritable​(boolean writable,
                                   boolean ownerOnly)
        Overrides:
        setWritable in class java.io.File
      • setWritable

        public boolean setWritable​(boolean writable)
        Overrides:
        setWritable in class java.io.File
      • setReadable

        public boolean setReadable​(boolean readable,
                                   boolean ownerOnly)
        Overrides:
        setReadable in class java.io.File
      • setReadable

        public boolean setReadable​(boolean readable)
        Overrides:
        setReadable in class java.io.File
      • setExecutable

        public boolean setExecutable​(boolean executable,
                                     boolean ownerOnly)
        Overrides:
        setExecutable in class java.io.File
      • setExecutable

        public boolean setExecutable​(boolean executable)
        Overrides:
        setExecutable in class java.io.File
      • getTotalSpace

        public long getTotalSpace()
        Overrides:
        getTotalSpace in class java.io.File
      • getFreeSpace

        public long getFreeSpace()
        Overrides:
        getFreeSpace in class java.io.File
      • getUsableSpace

        public long getUsableSpace()
        Overrides:
        getUsableSpace in class java.io.File