Class FileTreeIterator


  • public class FileTreeIterator
    extends WorkingTreeIterator
    Working directory iterator for standard Java IO.

    This iterator uses the standard java.io package to read the specified working directory as part of a TreeWalk.

    • Field Detail

      • directory

        protected final File directory
        the starting directory. This directory should correspond to the root of the repository.
      • fs

        protected final FS fs
        the file system abstraction which will be necessary to perform certain file system operations.
    • Constructor Detail

      • FileTreeIterator

        public FileTreeIterator​(Repository repo)
        Create a new iterator to traverse the work tree and its children.
        Parameters:
        repo - the repository whose working tree will be scanned.
      • FileTreeIterator

        public FileTreeIterator​(File root,
                                FS fs,
                                WorkingTreeOptions options)
        Create a new iterator to traverse the given directory and its children.
        Parameters:
        root - the starting directory. This directory should correspond to the root of the repository.
        fs - the file system abstraction which will be necessary to perform certain file system operations.
        options - working tree options to be used
      • FileTreeIterator

        protected FileTreeIterator​(WorkingTreeIterator p,
                                   File root,
                                   FS fs)
        Create a new iterator to traverse a subdirectory.
        Parameters:
        p - the parent iterator we were created from.
        fs - the file system abstraction which will be necessary to perform certain file system operations.
        root - the subdirectory. This should be a directory contained within the parent directory.
    • Method Detail

      • getDirectory

        public File getDirectory()
        Returns:
        The root directory of this iterator
      • getEntryFile

        public File getEntryFile()
        Returns:
        The location of the working file. This is the same as new File(getDirectory(), getEntryPath()) but may be faster by reusing an internal File instance.