public static class FileTreeIterator.FileEntry extends WorkingTreeIterator.Entry
Modifier and Type | Field and Description |
---|---|
private FS.Attributes |
attributes |
private FS |
fs |
private FileMode |
mode |
encodedName, encodedNameLen
Constructor and Description |
---|
FileEntry(java.io.File f,
FS fs)
Create a new file entry.
|
FileEntry(java.io.File f,
FS fs,
FileTreeIterator.FileModeStrategy fileModeStrategy)
Create a new file entry given the specified FileModeStrategy
|
FileEntry(java.io.File f,
FS fs,
FS.Attributes attributes,
FileTreeIterator.FileModeStrategy fileModeStrategy)
Create a new file entry given the specified FileModeStrategy
|
Modifier and Type | Method and Description |
---|---|
java.io.File |
getFile()
Get the underlying file of this entry.
|
long |
getLastModified()
Deprecated.
|
java.time.Instant |
getLastModifiedInstant()
Get the last modified time of this entry.
|
long |
getLength()
Get the byte length of this entry.
|
FileMode |
getMode()
Get the type of this entry.
|
java.lang.String |
getName()
Get the name of this entry within its directory.
|
java.io.InputStream |
openInputStream()
Obtain an input stream to read the file content.
|
encodeName, toString
private final FileMode mode
private FS.Attributes attributes
private FS fs
public FileEntry(java.io.File f, FS fs)
f
- filefs
- file systempublic FileEntry(java.io.File f, FS fs, FileTreeIterator.FileModeStrategy fileModeStrategy)
f
- filefs
- file systemfileModeStrategy
- the strategy to use when determining the FileMode of a
file; controls gitlinks etc.public FileEntry(java.io.File f, FS fs, FS.Attributes attributes, FileTreeIterator.FileModeStrategy fileModeStrategy)
f
- filefs
- file systemattributes
- of the filefileModeStrategy
- the strategy to use when determining the FileMode of a
file; controls gitlinks etc.public FileMode getMode()
WorkingTreeIterator.Entry
Note: Efficient implementation required.
The implementation of this method must be efficient. If a subclass needs to compute the value they should cache the reference within an instance member instead.
getMode
in class WorkingTreeIterator.Entry
FileMode
.public java.lang.String getName()
WorkingTreeIterator.Entry
Efficient implementations are not required. The caller will obtain the name only once and cache it once obtained.
getName
in class WorkingTreeIterator.Entry
public long getLength()
WorkingTreeIterator.Entry
Note: Efficient implementation required.
The implementation of this method must be efficient. If a subclass needs to compute the value they should cache the reference within an instance member instead.
getLength
in class WorkingTreeIterator.Entry
@Deprecated public long getLastModified()
WorkingTreeIterator.Entry
Note: Efficient implementation required.
The implementation of this method must be efficient. If a subclass needs to compute the value they should cache the reference within an instance member instead.
getLastModified
in class WorkingTreeIterator.Entry
public java.time.Instant getLastModifiedInstant()
WorkingTreeIterator.Entry
Note: Efficient implementation required.
The implementation of this method must be efficient. If a subclass needs to compute the value they should cache the reference within an instance member instead.
getLastModifiedInstant
in class WorkingTreeIterator.Entry
public java.io.InputStream openInputStream() throws java.io.IOException
WorkingTreeIterator.Entry
Efficient implementations are not required. The caller will usually obtain the stream only once per entry, if at all.
The input stream should not use buffering if the implementation can avoid it. The caller will buffer as necessary to perform efficient block IO operations.
The caller will close the stream once complete.
openInputStream
in class WorkingTreeIterator.Entry
java.io.IOException
- the file could not be opened for reading.public java.io.File getFile()