Package org.gradle.api.file
Interface FileTreeElement
- All Known Subinterfaces:
- FileCopyDetails,- FileVisitDetails
public interface FileTreeElement
Information about a file in a directory/file tree.
- 
Method SummaryModifier and TypeMethodDescriptionbooleanCopies this file to the given target file.voidcopyTo(OutputStream output) Copies the content of this file to an output stream.getFile()Returns the file being visited.longReturns the last modified time of this file at the time of file traversal.intgetMode()Deprecated.getName()Returns the base name of this file.getPath()Returns the path of this file, relative to the root of the containing file tree.Provides a read-only view of access permissions of this file.Returns the path of this file, relative to the root of the containing file tree.longgetSize()Returns the size of this file at the time of file traversal.booleanReturns true if this element is a directory, or false if this element is a regular file.open()Opens this file as an input stream.
- 
Method Details- 
getFileFile getFile()Returns the file being visited.- Returns:
- The file. Never returns null.
 
- 
isDirectoryboolean isDirectory()Returns true if this element is a directory, or false if this element is a regular file.- Returns:
- true if this element is a directory.
 
- 
getLastModifiedlong getLastModified()Returns the last modified time of this file at the time of file traversal.- Returns:
- The last modified time.
 
- 
getSizelong getSize()Returns the size of this file at the time of file traversal.- Returns:
- The size, in bytes.
 
- 
openInputStream open()Opens this file as an input stream. Generally, calling this method is more performant than callingnew FileInputStream(getFile()).- Returns:
- The input stream. Never returns null. The caller is responsible for closing this stream.
 
- 
copyToCopies the content of this file to an output stream. Generally, calling this method is more performant than callingnew FileInputStream(getFile()).- Parameters:
- output- The output stream to write to. The caller is responsible for closing this stream.
 
- 
copyToCopies this file to the given target file. Does not copy the file if the target is already a copy of this file.- Parameters:
- target- the target file.
- Returns:
- true if this file was copied, false if it was up-to-date
 
- 
getNameString getName()Returns the base name of this file.- Returns:
- The name. Never returns null.
 
- 
getPathString getPath()Returns the path of this file, relative to the root of the containing file tree. Always uses '/' as the hierarchy separator, regardless of platform file separator. Same as callinggetRelativePath().getPathString().- Returns:
- The path. Never returns null.
 
- 
getRelativePathRelativePath getRelativePath()Returns the path of this file, relative to the root of the containing file tree.- Returns:
- The path. Never returns null.
 
- 
getModeDeprecated.UsegetPermissions()instead. This method is scheduled for removal in Gradle 9.0.Returns the UNIX-style file permission mode of this file.
- 
getPermissionsFilePermissions getPermissions()Provides a read-only view of access permissions of this file. For details seeFilePermissions.- Since:
- 8.3
 
 
- 
getPermissions()instead.