Package digilib.io

Class FsDirectory


  • public class FsDirectory
    extends Object
    Class for filesystem directories
    Author:
    casties
    • Field Detail

      • logger

        protected org.slf4j.Logger logger
      • dir

        protected File dir
        File object pointing to the directory
      • parent

        protected FsDirectory parent
        parent directory
      • list

        protected String[] list
        list of filenames in the directory
    • Constructor Detail

      • FsDirectory

        public FsDirectory()
        Default constructor.
      • FsDirectory

        public FsDirectory​(File d)
        Constructor taking a File object.
        Parameters:
        d - the File
      • FsDirectory

        public FsDirectory​(File dir,
                           FsDirectory parent)
        Constructor taking a File object and a parent.
        Parameters:
        dir - the File
        parent - the Directory
      • FsDirectory

        public FsDirectory​(String dn)
        Constructor taking a directory name.
        Parameters:
        dn - the name
    • Method Detail

      • readDir

        public boolean readDir()
        Reads the names of the files in the directory. Fills the filenames array. Returns if the operation was successful.
        Returns:
        if the operation was successful
      • getDir

        public File getDir()
        Returns the directory File object.
        Returns:
        the File
      • toPath

        public Path toPath()
        Returns the directory as Path object.
        Returns:
      • setDir

        public void setDir​(File dir)
        Sets the directory File object.
        Parameters:
        dir - the File
      • getParent

        public FsDirectory getParent()
        Returns the parent Directory object.
        Returns:
        the Directory
      • setParent

        public void setParent​(FsDirectory parent)
        Sets the parent Directory object.
        Parameters:
        parent - the Directory
      • getFilenames

        public String[] getFilenames()
        Returns the filenames.
        Returns:
        the filenames
      • setFilenames

        public void setFilenames​(String[] filenames)
        Sets the filenames.
        Parameters:
        filenames - the filenames
      • clearFilenames

        public void clearFilenames()
        Resets the filenames.