Package org.eclipse.jgit.treewalk
Class FileTreeIterator
- java.lang.Object
-
- org.eclipse.jgit.treewalk.AbstractTreeIterator
-
- org.eclipse.jgit.treewalk.WorkingTreeIterator
-
- org.eclipse.jgit.treewalk.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 aTreeWalk
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FileTreeIterator.FileEntry
Wrapper for a standard Java IO file-
Nested classes/interfaces inherited from class org.eclipse.jgit.treewalk.WorkingTreeIterator
WorkingTreeIterator.Entry, WorkingTreeIterator.MetadataDiff
-
-
Field Summary
Fields Modifier and Type Field Description protected java.io.File
directory
the starting directory.protected FS
fs
the file system abstraction which will be necessary to perform certain file system operations.-
Fields inherited from class org.eclipse.jgit.treewalk.WorkingTreeIterator
EOF, repository
-
Fields inherited from class org.eclipse.jgit.treewalk.AbstractTreeIterator
DEFAULT_PATH_SIZE, mode, path, pathLen, pathOffset, zeroid
-
-
Constructor Summary
Constructors Modifier Constructor Description FileTreeIterator(java.io.File root, FS fs, WorkingTreeOptions options)
Create a new iterator to traverse the given directory and its children.FileTreeIterator(Repository repo)
Create a new iterator to traverse the work tree and its children.protected
FileTreeIterator(WorkingTreeIterator p, java.io.File root, FS fs)
Create a new iterator to traverse a subdirectory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AbstractTreeIterator
createSubtreeIterator(ObjectReader reader)
Create a new iterator for the current entry's subtree.java.io.File
getDirectory()
java.io.File
getEntryFile()
protected byte[]
idSubmodule(WorkingTreeIterator.Entry e)
Get submodule id for given entry.-
Methods inherited from class org.eclipse.jgit.treewalk.WorkingTreeIterator
back, compareMetadata, current, eof, first, getEntryAttributesNode, getEntryContentLength, getEntryLastModified, getEntryLength, getGlobalAttributesNode, getIndexFileMode, getInfoAttributesNode, getOptions, hasId, idBuffer, idOffset, idSubmodule, init, initRootIterator, isEntryIgnored, isEntryIgnored, isModeDifferent, isModified, isModified, next, openEntryStream, reset, setDirCacheIterator
-
Methods inherited from class org.eclipse.jgit.treewalk.AbstractTreeIterator
createEmptyTreeIterator, createSubtreeIterator, ensurePathCapacity, getEntryFileMode, getEntryObjectId, getEntryObjectId, getEntryPathBuffer, getEntryPathHashCode, getEntryPathLength, getEntryPathString, getEntryRawMode, getName, getNameLength, getNameOffset, growPath, idEqual, pathCompare, pathCompare, skip, stopWalk, toString
-
-
-
-
Field Detail
-
directory
protected final java.io.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(java.io.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, java.io.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
-
createSubtreeIterator
public AbstractTreeIterator createSubtreeIterator(ObjectReader reader) throws IncorrectObjectTypeException, java.io.IOException
Description copied from class:AbstractTreeIterator
Create a new iterator for the current entry's subtree.The parent reference of the iterator must be
this
, otherwise the caller would not be able to exit out of the subtree iterator correctly and return to continue walkingthis
.- Specified by:
createSubtreeIterator
in classAbstractTreeIterator
- Parameters:
reader
- reader to load the tree data from.- Returns:
- a new parser that walks over the current subtree.
- Throws:
IncorrectObjectTypeException
- the current entry is not actually a tree and cannot be parsed as though it were a tree.java.io.IOException
- a loose object or pack file could not be read.
-
getDirectory
public java.io.File getDirectory()
- Returns:
- The root directory of this iterator
-
getEntryFile
public java.io.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.
-
idSubmodule
protected byte[] idSubmodule(WorkingTreeIterator.Entry e)
Description copied from class:WorkingTreeIterator
Get submodule id for given entry.- Overrides:
idSubmodule
in classWorkingTreeIterator
- Returns:
- non-null submodule id
-
-