Stay organized with collections
    
    
      
      Save and categorize content based on your preferences.
    
  
  
    
  
  
  
  
    
  
  
    
    
    
    PosixFileAttributes
    interface PosixFileAttributes : BasicFileAttributes
    
    File attributes associated with files on file systems used by operating systems that implement the Portable Operating System Interface (POSIX) family of standards. 
     The POSIX attributes of a file are retrieved using a PosixFileAttributeView by invoking its readAttributes method.
    Summary
    
    
      
        
          | Inherited functions | 
        
          | From class BasicFileAttributes
                
                  
                    | FileTime! | creationTime()
                         Returns the creation time. The creation time is the time that the file was created.   If the file system implementation does not support a time stamp to indicate the time when the file was created then this method returns an implementation specific default value, typically the last-modified-timeor aFileTimerepresenting the epoch (1970-01-01T00:00:00Z). |  
                    | Any! | fileKey()
                         Returns an object that uniquely identifies the given file, or nullif a file key is not available. On some platforms or file systems it is possible to use an identifier, or a combination of identifiers to uniquely identify a file. Such identifiers are important for operations such as file tree traversal in file systems that support symbolic links or file systems that allow a file to be an entry in more than one directory. On UNIX file systems, for example, the device ID and inode are commonly used for such purposes.  The file key returned by this method can only be guaranteed to be unique if the file system and files remain static. Whether a file system re-uses identifiers after a file is deleted is implementation dependent and therefore unspecified.   File keys returned by this method can be compared for equality and are suitable for use in collections. If the file system and files remain static, and two files are the samewith non-nullfile keys, then their file keys are equal. |  
                    | Boolean | isDirectory()
                         Tells whether the file is a directory. |  
                    | Boolean | isOther()
                         Tells whether the file is something other than a regular file, directory, or symbolic link. |  
                    | Boolean | isRegularFile()
                         Tells whether the file is a regular file with opaque content. |  
                    | Boolean | isSymbolicLink()
                         Tells whether the file is a symbolic link. |  
                    | FileTime! | lastAccessTime()
                         Returns the time of last access.   If the file system implementation does not support a time stamp to indicate the time of last access then this method returns an implementation specific default value, typically the last-modified-timeor aFileTimerepresenting the epoch (1970-01-01T00:00:00Z). |  
                    | FileTime! | lastModifiedTime()
                         Returns the time of last modification.   If the file system implementation does not support a time stamp to indicate the time of last modification then this method returns an implementation specific default value, typically a FileTimerepresenting the epoch (1970-01-01T00:00:00Z). |  
                    | Long | size()
                         Returns the size of the file (in bytes). The size may differ from the actual size on the file system due to compression, support for sparse files, or other reasons. The size of files that are not regularfiles is implementation specific and therefore unspecified. |  | 
      
    
    Public methods
    
      group
      
      abstract fun group(): GroupPrincipal!
      Returns the group owner of the file.
      
      
     
    
      owner
      
      abstract fun owner(): UserPrincipal!
      Returns the owner of the file.
      
      
     
    
      permissions
      
      abstract fun permissions(): MutableSet<PosixFilePermission!>!
      Returns the permissions of the file. The file permissions are returned as a set of PosixFilePermission elements. The returned set is a copy of the file permissions and is modifiable. This allows the result to be modified and passed to the setPermissions method to update the file's permissions.
      
      
     
  
  
  
    
  
 
  
    
    
      
       
    
    
  
  
  Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
  Last updated 2025-02-10 UTC.
  
  
  
    
      [null,null,["Last updated 2025-02-10 UTC."],[],[]]