Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | METHOD | DETAIL: FIELD | METHOD

## org.gradle.api.file
[Java] Interface FileTreeElement

    public interface FileTreeElement

Information about a file in a FileTree.

Method Summary
`void` | `copyTo(java.io.OutputStream outstr)` Copies the content of this file to an output stream.
`boolean` | `copyTo(java.io.File target)` Copies this file to the given target file.
`java.io.File` | `getFile()` Returns the file being visited.
`long` | `getLastModified()` Returns the last modified time of this file.
`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.
`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.
`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

### copyTo

    public void copyTo(java.io.OutputStream outstr)

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

### copyTo

    public 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

### getFile

    public java.io.File getFile()

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

### getLastModified

    public long getLastModified()

  Returns the last modified time of this file. Generally, calling this method is more performant than calling `getFile().lastModified()`
  Returns:
    The last modified time.

### getName

    public java.lang.String getName()

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

### getPath

    public 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

    public RelativePath getRelativePath()

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

### getSize

    public long getSize()

  Returns the size of this file. Generally, calling this method is more performant than calling `getFile().length()`.
  Returns:
    The size, in bytes.

### isDirectory

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

### open

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

Groovy Documentation