Class RemoteFileInfo

java.lang.Object
org.metricshub.winrm.RemoteFileInfo

public final class RemoteFileInfo extends Object
The properties of a file or directory on the remote host, as returned by RemoteFile.info() and RemoteDirectoryListing: an immutable value.

Timestamps come from the host's UTC file times, with their 100-nanosecond precision. The attribute accessors decode the Windows FileAttributes bit flags; attributes() returns the raw value for anything else (e.g. 0x800 compressed, 0x4000 encrypted).

  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Get the raw Windows FileAttributes bit flags.
    Get the creation time.
    boolean
    equals(Object other)
     
    int
     
    boolean
    Tell whether the entry is marked for archiving (backup).
    boolean
    Tell whether the entry is a directory.
    boolean
    Tell whether the entry is hidden.
    boolean
    Tell whether the entry is read-only.
    boolean
    Tell whether the entry is a reparse point: a junction, a symbolic link, a mount point, or a cloud placeholder.
    boolean
    Tell whether the entry is a system file or directory.
    Get the time of the last access.
    Get the time of the last write.
    Get the last element of the path: the file or directory name (C: for a drive root).
    Get the full path of the entry, as reported by the host (absolute, with backslashes).
    long
    Get the size of the file.
     

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Method Details

    • path

      public String path()
      Get the full path of the entry, as reported by the host (absolute, with backslashes).
      Returns:
      the path
    • name

      public String name()
      Get the last element of the path: the file or directory name (C: for a drive root).
      Returns:
      the name
    • isDirectory

      public boolean isDirectory()
      Tell whether the entry is a directory.
      Returns:
      true for a directory (including a junction or a directory symbolic link)
    • size

      public long size()
      Get the size of the file.
      Returns:
      the size in bytes, 0 for a directory
    • lastModified

      public Instant lastModified()
      Get the time of the last write.
      Returns:
      the last modification time
    • created

      public Instant created()
      Get the creation time.
      Returns:
      the creation time
    • lastAccessed

      public Instant lastAccessed()
      Get the time of the last access. Windows updates it lazily, or not at all when last access updates are disabled (the default on many versions): do not rely on it.
      Returns:
      the last access time
    • isHidden

      public boolean isHidden()
      Tell whether the entry is hidden.
      Returns:
      true when the hidden attribute is set
    • isSystem

      public boolean isSystem()
      Tell whether the entry is a system file or directory.
      Returns:
      true when the system attribute is set
    • isReadOnly

      public boolean isReadOnly()
      Tell whether the entry is read-only.
      Returns:
      true when the read-only attribute is set
    • isArchive

      public boolean isArchive()
      Tell whether the entry is marked for archiving (backup).
      Returns:
      true when the archive attribute is set
    • isReparsePoint

      public boolean isReparsePoint()
      Tell whether the entry is a reparse point: a junction, a symbolic link, a mount point, or a cloud placeholder. A listing reports reparse points but never descends into them.
      Returns:
      true when the reparse point attribute is set
    • attributes

      public int attributes()
      Get the raw Windows FileAttributes bit flags.
      Returns:
      the attributes
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object