Schnittstelle FileTreeElement

Alle bekannten Unterschnittstellen:
FileCopyDetails, FileVisitDetails

public interface FileTreeElement
Information about a file in a directory/file tree.
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    boolean
    copyTo(File target)
    Copies this file to the given target file.
    void
    Copies the content of this file to an output stream.
    Returns the file being visited.
    long
    Returns the last modified time of this file at the time of file traversal.
    int
    Veraltet.
    Use getPermissions() instead.
    Returns the base name of this file.
    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.
    long
    Returns the size of this file at the time of file traversal.
    boolean
    Returns true if this element is a directory, or false if this element is a regular file.
    Opens this file as an input stream.
  • Methodendetails

    • getFile

      File getFile()
      Returns the file being visited.
      Gibt zurück:
      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.
      Gibt zurück:
      true if this element is a directory.
    • getLastModified

      long getLastModified()
      Returns the last modified time of this file at the time of file traversal.
      Gibt zurück:
      The last modified time.
    • getSize

      long getSize()
      Returns the size of this file at the time of file traversal.
      Gibt zurück:
      The size, in bytes.
    • open

      InputStream open()
      Opens this file as an input stream. Generally, calling this method is more performant than calling new FileInputStream(getFile()).
      Gibt zurück:
      The input stream. Never returns null. The caller is responsible for closing this stream.
    • copyTo

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

      boolean copyTo(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.
      Parameter:
      target - the target file.
      Gibt zurück:
      true if this file was copied, false if it was up-to-date
    • getName

      String getName()
      Returns the base name of this file.
      Gibt zurück:
      The name. Never returns null.
    • getPath

      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().
      Gibt zurück:
      The path. Never returns null.
    • getRelativePath

      RelativePath getRelativePath()
      Returns the path of this file, relative to the root of the containing file tree.
      Gibt zurück:
      The path. Never returns null.
    • getMode

      @Deprecated int getMode()
      Veraltet.
      Use getPermissions() instead. This method is scheduled for removal in Gradle 9.0.
      Returns the UNIX-style file permission mode of this file.
    • getPermissions

      FilePermissions getPermissions()
      Provides a read-only view of access permissions of this file. For details see FilePermissions.
      Seit:
      8.3