public class FileTreeIterator extends WorkingTreeIterator
This iterator uses the standard java.io
package to read the
specified working directory as part of a TreeWalk
.
Modifier and Type | Class | Description |
---|---|---|
static class |
FileTreeIterator.FileEntry |
Wrapper for a standard Java IO file
|
WorkingTreeIterator.Entry, WorkingTreeIterator.MetadataDiff
Modifier and Type | Field | Description |
---|---|---|
protected File |
directory |
the starting directory.
|
protected FS |
fs |
the file system abstraction which will be necessary to perform certain
file system operations.
|
DEFAULT_PATH_SIZE, mode, path, pathLen, pathOffset, zeroid
EOF, repository
Modifier | Constructor | Description |
---|---|---|
|
FileTreeIterator(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,
File root,
FS fs) |
Create a new iterator to traverse a subdirectory.
|
Modifier and Type | Method | Description |
---|---|---|
AbstractTreeIterator |
createSubtreeIterator(ObjectReader reader) |
Create a new iterator for the current entry's subtree.
|
File |
getDirectory() |
|
File |
getEntryFile() |
|
protected byte[] |
idSubmodule(WorkingTreeIterator.Entry e) |
Get submodule id for given entry.
|
createEmptyTreeIterator, createSubtreeIterator, ensurePathCapacity, getEntryFileMode, getEntryObjectId, getEntryObjectId, getEntryPathBuffer, getEntryPathHashCode, getEntryPathLength, getEntryPathString, getEntryRawMode, getName, getNameLength, getNameOffset, growPath, idEqual, pathCompare, pathCompare, skip, stopWalk, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
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
protected final File directory
protected final FS fs
public FileTreeIterator(Repository repo)
repo
- the repository whose working tree will be scanned.public FileTreeIterator(File root, FS fs, WorkingTreeOptions options)
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 usedprotected FileTreeIterator(WorkingTreeIterator p, File root, FS fs)
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.public AbstractTreeIterator createSubtreeIterator(ObjectReader reader) throws IncorrectObjectTypeException, IOException
AbstractTreeIterator
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 walking this
.
createSubtreeIterator
in class AbstractTreeIterator
reader
- reader to load the tree data from.IncorrectObjectTypeException
- the current entry is not actually a tree and cannot be parsed
as though it were a tree.IOException
- a loose object or pack file could not be read.public File getDirectory()
public File getEntryFile()
new
File(getDirectory(), getEntryPath())
but may be faster by
reusing an internal File instance.protected byte[] idSubmodule(WorkingTreeIterator.Entry e)
WorkingTreeIterator
idSubmodule
in class WorkingTreeIterator
Copyright © 2018. All rights reserved.