PosixFileAttributes
Stay organized with collections
Save and categorize content based on your preferences.
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.
Inherited Method Summary
From interface
java.nio.file.attribute.BasicFileAttributes
abstract
FileTime
|
|
abstract
Object
|
fileKey()
Returns an object that uniquely identifies the given file, or null if a file key is not available.
|
abstract
boolean
|
|
abstract
boolean
|
isOther()
Tells whether the file is something other than a regular file, directory,
or symbolic link.
|
abstract
boolean
|
isRegularFile()
Tells whether the file is a regular file with opaque content.
|
abstract
boolean
|
|
abstract
FileTime
|
|
abstract
FileTime
|
|
abstract
long
|
size()
Returns the size of the file (in bytes).
|
Public Methods
Returns the group owner of the file.
Returns the owner of the file.
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.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-07-10 UTC."],[[["\u003cp\u003e\u003ccode\u003ePosixFileAttributes\u003c/code\u003e provides access to file attributes specific to POSIX-compliant file systems, including owner, group, and permissions.\u003c/p\u003e\n"],["\u003cp\u003eIt extends \u003ccode\u003eBasicFileAttributes\u003c/code\u003e, inheriting standard file attributes like size, creation time, and modification time.\u003c/p\u003e\n"],["\u003cp\u003eFile attributes are retrieved using a \u003ccode\u003ePosixFileAttributeView\u003c/code\u003e object by invoking its \u003ccode\u003ereadAttributes()\u003c/code\u003e method.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003epermissions\u003c/code\u003e method returns a modifiable set of \u003ccode\u003ePosixFilePermission\u003c/code\u003e elements that can be used to update the file's permissions.\u003c/p\u003e\n"]]],["`PosixFileAttributes` defines file attributes for POSIX-compliant systems. Key actions involve retrieving file details through a `PosixFileAttributeView`. Core information accessible includes the file's group owner via `group()`, the file owner via `owner()`, and the file permissions via `permissions()`. It also inherits methods from `BasicFileAttributes` such as `creationTime()`, `size()`, `lastModifiedTime()`, `isRegularFile()`, among other file properties. Returned permission sets are modifiable.\n"],null,["public interface **PosixFileAttributes** implements [BasicFileAttributes](../../../../../reference/java/nio/file/attribute/BasicFileAttributes.html) \nFile attributes associated with files on file systems used by operating systems\nthat implement the Portable Operating System Interface (POSIX) family of\nstandards.\n\nThe POSIX attributes of a file are retrieved using a [PosixFileAttributeView](../../../../../reference/java/nio/file/attribute/PosixFileAttributeView.html) by invoking its [readAttributes](../../../../../reference/java/nio/file/attribute/PosixFileAttributeView.html#readAttributes()) method. \n\nPublic Method Summary\n\nInherited Method Summary \nFrom interface [java.nio.file.attribute.BasicFileAttributes](../../../../../reference/java/nio/file/attribute/BasicFileAttributes.html) \n\nPublic Methods \n\npublic abstract [GroupPrincipal](../../../../../reference/java/nio/file/attribute/GroupPrincipal.html)\n**group**\n() \nReturns the group owner of the file. \n\nReturns\n\n- the file group owner \n\nSee Also\n\n- [PosixFileAttributeView.setGroup(GroupPrincipal)](../../../../../reference/java/nio/file/attribute/PosixFileAttributeView.html#setGroup(java.nio.file.attribute.GroupPrincipal)) \n\npublic abstract [UserPrincipal](../../../../../reference/java/nio/file/attribute/UserPrincipal.html)\n**owner**\n() \nReturns the owner of the file. \n\nReturns\n\n- the file owner \n\nSee Also\n\n- [FileOwnerAttributeView.setOwner(UserPrincipal)](../../../../../reference/java/nio/file/attribute/FileOwnerAttributeView.html#setOwner(java.nio.file.attribute.UserPrincipal)) \n\npublic abstract [Set](../../../../../reference/java/util/Set.html)\\\u003c[PosixFilePermission](../../../../../reference/java/nio/file/attribute/PosixFilePermission.html)\\\u003e\n**permissions**\n() \nReturns the permissions of the file. The file permissions are returned\nas a set of [PosixFilePermission](../../../../../reference/java/nio/file/attribute/PosixFilePermission.html) elements. The returned set is a\ncopy of the file permissions and is modifiable. This allows the result\nto be modified and passed to the [setPermissions](../../../../../reference/java/nio/file/attribute/PosixFileAttributeView.html#setPermissions(java.util.Set\u003cjava.nio.file.attribute.PosixFilePermission\u003e)) method to update the file's permissions. \n\nReturns\n\n- the file permissions \n\nSee Also\n\n- [PosixFileAttributeView.setPermissions(Set)](../../../../../reference/java/nio/file/attribute/PosixFileAttributeView.html#setPermissions(java.util.Set\u003cjava.nio.file.attribute.PosixFilePermission\u003e))"]]