Stay organized with collections
Save and categorize content based on your preferences.
DosFileAttributes
public
interface
DosFileAttributes
implements
BasicFileAttributes
java.nio.file.attribute.DosFileAttributes
|
File attributes associated with a file in a file system that supports
legacy "DOS" attributes.
Usage Example:
Path file = ...
DosFileAttributes attrs = Files.readAttributes(file, DosFileAttributes.class);
Summary
Public methods |
abstract
boolean
|
isArchive()
Returns the value of the archive attribute.
|
abstract
boolean
|
isHidden()
Returns the value of the hidden attribute.
|
abstract
boolean
|
isReadOnly()
Returns the value of the read-only attribute.
|
abstract
boolean
|
isSystem()
Returns the value of the system attribute.
|
Public methods
isArchive
public abstract boolean isArchive ()
Returns the value of the archive attribute.
This attribute is typically used by backup programs.
Returns |
boolean |
the value of the archive attribute |
isHidden
public abstract boolean isHidden ()
Returns the value of the hidden attribute.
This attribute is often used to indicate if the file is visible to
users.
Returns |
boolean |
the value of the hidden attribute |
isReadOnly
public abstract boolean isReadOnly ()
Returns the value of the read-only attribute.
This attribute is often used as a simple access control mechanism
to prevent files from being deleted or updated. Whether the file system
or platform does any enforcement to prevent read-only files
from being updated is implementation specific.
Returns |
boolean |
the value of the read-only attribute |
isSystem
public abstract boolean isSystem ()
Returns the value of the system attribute.
This attribute is often used to indicate that the file is a component
of the operating system.
Returns |
boolean |
the value of the system attribute |
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.
[[["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 2025-02-10 UTC."],[],[],null,["# DosFileAttributes\n\nAdded in [API level 26](/guide/topics/manifest/uses-sdk-element#ApiLevels) \nSummary: [Methods](#pubmethods) \\| [Inherited Methods](#inhmethods) \n\nDosFileAttributes\n=================\n\n\n`\npublic\n\n\ninterface\nDosFileAttributes\n`\n\n\n`\n\n\nimplements\n\n`[BasicFileAttributes](/reference/java/nio/file/attribute/BasicFileAttributes)`\n\n\n`\n\n|-------------------------------------------|\n| java.nio.file.attribute.DosFileAttributes |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nFile attributes associated with a file in a file system that supports\nlegacy \"DOS\" attributes.\n\n**Usage Example:** \n\n```\n Path file = ...\n DosFileAttributes attrs = Files.readAttributes(file, DosFileAttributes.class);\n \n```\n\n\u003cbr /\u003e\n\nSummary\n-------\n\n| ### Public methods ||\n|---------------------|---------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract boolean` | ` `[isArchive](/reference/java/nio/file/attribute/DosFileAttributes#isArchive())`() ` Returns the value of the archive attribute. |\n| ` abstract boolean` | ` `[isHidden](/reference/java/nio/file/attribute/DosFileAttributes#isHidden())`() ` Returns the value of the hidden attribute. |\n| ` abstract boolean` | ` `[isReadOnly](/reference/java/nio/file/attribute/DosFileAttributes#isReadOnly())`() ` Returns the value of the read-only attribute. |\n| ` abstract boolean` | ` `[isSystem](/reference/java/nio/file/attribute/DosFileAttributes#isSystem())`() ` Returns the value of the system attribute. |\n\n| ### Inherited methods |\n|-----------------------|---|\n| From interface ` `[java.nio.file.attribute.BasicFileAttributes](/reference/java/nio/file/attribute/BasicFileAttributes)` ` |---------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract `[FileTime](/reference/java/nio/file/attribute/FileTime) | ` `[creationTime](/reference/java/nio/file/attribute/BasicFileAttributes#creationTime())`() ` Returns the creation time. | | ` abstract `[Object](/reference/java/lang/Object) | ` `[fileKey](/reference/java/nio/file/attribute/BasicFileAttributes#fileKey())`() ` Returns an object that uniquely identifies the given file, or `null` if a file key is not available. | | ` abstract boolean` | ` `[isDirectory](/reference/java/nio/file/attribute/BasicFileAttributes#isDirectory())`() ` Tells whether the file is a directory. | | ` abstract boolean` | ` `[isOther](/reference/java/nio/file/attribute/BasicFileAttributes#isOther())`() ` Tells whether the file is something other than a regular file, directory, or symbolic link. | | ` abstract boolean` | ` `[isRegularFile](/reference/java/nio/file/attribute/BasicFileAttributes#isRegularFile())`() ` Tells whether the file is a regular file with opaque content. | | ` abstract boolean` | ` `[isSymbolicLink](/reference/java/nio/file/attribute/BasicFileAttributes#isSymbolicLink())`() ` Tells whether the file is a symbolic link. | | ` abstract `[FileTime](/reference/java/nio/file/attribute/FileTime) | ` `[lastAccessTime](/reference/java/nio/file/attribute/BasicFileAttributes#lastAccessTime())`() ` Returns the time of last access. | | ` abstract `[FileTime](/reference/java/nio/file/attribute/FileTime) | ` `[lastModifiedTime](/reference/java/nio/file/attribute/BasicFileAttributes#lastModifiedTime())`() ` Returns the time of last modification. | | ` abstract long` | ` `[size](/reference/java/nio/file/attribute/BasicFileAttributes#size())`() ` Returns the size of the file (in bytes). | ||\n\nPublic methods\n--------------\n\n### isArchive\n\nAdded in [API level 26](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract boolean isArchive ()\n```\n\nReturns the value of the archive attribute.\n\nThis attribute is typically used by backup programs.\n\n\u003cbr /\u003e\n\n| Returns ||\n|-----------|-------------------------------------------|\n| `boolean` | the value of the archive attribute \u003cbr /\u003e |\n\n### isHidden\n\nAdded in [API level 26](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract boolean isHidden ()\n```\n\nReturns the value of the hidden attribute.\n\nThis attribute is often used to indicate if the file is visible to\nusers.\n\n\u003cbr /\u003e\n\n| Returns ||\n|-----------|------------------------------------------|\n| `boolean` | the value of the hidden attribute \u003cbr /\u003e |\n\n### isReadOnly\n\nAdded in [API level 26](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract boolean isReadOnly ()\n```\n\nReturns the value of the read-only attribute.\n\nThis attribute is often used as a simple access control mechanism\nto prevent files from being deleted or updated. Whether the file system\nor platform does any enforcement to prevent *read-only* files\nfrom being updated is implementation specific.\n\n\u003cbr /\u003e\n\n| Returns ||\n|-----------|---------------------------------------------|\n| `boolean` | the value of the read-only attribute \u003cbr /\u003e |\n\n### isSystem\n\nAdded in [API level 26](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract boolean isSystem ()\n```\n\nReturns the value of the system attribute.\n\nThis attribute is often used to indicate that the file is a component\nof the operating system.\n\n\u003cbr /\u003e\n\n| Returns ||\n|-----------|------------------------------------------|\n| `boolean` | the value of the system attribute \u003cbr /\u003e |"]]