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 Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `copyTo​(java.io.File target)` | Copies this file to the given target file.
    `void` | `copyTo​(java.io.OutputStream output)` | Copies the content of this file to an output stream.
    `java.io.File` | `getFile()` | Returns the file being visited.
    `long` | `getLastModified()` | Returns the last modified time of this file at the time of file traversal.
    `int` | `getMode()` |
    `java.lang.String` | `getName()` | Returns the base name of this file.
    `java.lang.String` | `getPath()` | Returns the path of this file, relative to the root of the containing file tree.
    `FilePermissions` | `getPermissions()` | Provides a read-only view of access permissions of this file.
    `RelativePath` | `getRelativePath()` | Returns the path of this file, relative to the root of the containing file tree.
    `long` | `getSize()` | Returns the size of this file at the time of file traversal.
    `boolean` | `isDirectory()` | Returns true if this element is a directory, or false if this element is a regular file.
    `java.io.InputStream` | `open()` | Opens this file as an input stream.

- - ### Method Detail

    - #### getFile

          java.io.File getFile()

      Returns the file being visited.
      Returns:
        The file. Never returns null.

    - #### isDirectory

          boolean 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.

    - #### getLastModified

          long getLastModified()

      Returns the last modified time of this file at the time of file traversal.
      Returns:
        The last modified time.

    - #### getSize

          long getSize()

      Returns the size of this file at the time of file traversal.
      Returns:
        The size, in bytes.

    - #### open

          java.io.InputStream open()

      Opens this file as an input stream. Generally, calling this method is more performant than calling `new FileInputStream(getFile())`.
      Returns:
        The input stream. Never returns null. The caller is responsible for closing this stream.

    - #### copyTo

          void copyTo​(java.io.OutputStream output)

      Copies the content of this file to an output stream. Generally, calling this method is more performant than calling `new FileInputStream(getFile())`.
      Parameters:
        `output` - The output stream to write to. The caller is responsible for closing this stream.

    - #### copyTo

          boolean copyTo​(java.io.File target)

      Copies 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

    - #### getName

          java.lang.String getName()

      Returns the base name of this file.
      Returns:
        The name. Never returns null.

    - #### getPath

          java.lang.String 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 calling `getRelativePath().getPathString()`.
      Returns:
        The path. Never returns null.

    - #### getRelativePath

          RelativePath getRelativePath()

      Returns the path of this file, relative to the root of the containing file tree.
      Returns:
        The path. Never returns null.

    - #### getMode

          int getMode()

    - #### getPermissions

          @Incubating
          FilePermissions getPermissions()

      Provides a read-only view of access permissions of this file. For details see `FilePermissions`.
      Since:
        8.3