Stay organized with collections
Save and categorize content based on your preferences.
FileAttribute
public
interface
FileAttribute
java.nio.file.attribute.FileAttribute<T>
|
An object that encapsulates the value of a file attribute that can be set
atomically when creating a new file or directory by invoking the createFile
or createDirectory
methods.
Summary
Public methods |
abstract
String
|
name()
Returns the attribute name.
|
abstract
T
|
value()
Returns the attribute value.
|
Public methods
name
public abstract String name ()
Returns the attribute name.
Returns |
String |
The attribute name |
value
public abstract T value ()
Returns the attribute value.
Returns |
T |
The attribute value |
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."],[],[],null,["# FileAttribute\n\nAdded in [API level 26](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\nFileAttribute\n=============\n\n\n`\npublic\n\n\ninterface\nFileAttribute\n`\n\n\n`\n\n\n`\n\n|--------------------------------------------|\n| java.nio.file.attribute.FileAttribute\\\u003cT\\\u003e |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nAn object that encapsulates the value of a file attribute that can be set\natomically when creating a new file or directory by invoking the [createFile](/reference/java/nio/file/Files#createFile(java.nio.file.Path,%20java.nio.file.attribute.FileAttribute\u003c?\u003e[])) or [createDirectory](/reference/java/nio/file/Files#createDirectory(java.nio.file.Path,%20java.nio.file.attribute.FileAttribute\u003c?\u003e[])) methods. \n**See also:**\n\n- [PosixFilePermissions.asFileAttribute(Set)](/reference/java/nio/file/attribute/PosixFilePermissions#asFileAttribute(java.util.Set\u003cjava.nio.file.attribute.PosixFilePermission\u003e))\n\nSummary\n-------\n\n| ### Public methods ||\n|---------------------------------------------------|--------------------------------------------------------------------------------------------------------|\n| ` abstract `[String](/reference/java/lang/String) | ` `[name](/reference/java/nio/file/attribute/FileAttribute#name())`() ` Returns the attribute name. |\n| ` abstract T` | ` `[value](/reference/java/nio/file/attribute/FileAttribute#value())`() ` Returns the attribute value. |\n\nPublic methods\n--------------\n\n### name\n\nAdded in [API level 26](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract String name ()\n```\n\nReturns the attribute name.\n\n\u003cbr /\u003e\n\n| Returns ||\n|---------------------------------------|---------------------------|\n| [String](/reference/java/lang/String) | The attribute name \u003cbr /\u003e |\n\n### value\n\nAdded in [API level 26](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract T value ()\n```\n\nReturns the attribute value.\n\n\u003cbr /\u003e\n\n| Returns ||\n|-----|----------------------------|\n| `T` | The attribute value \u003cbr /\u003e |"]]