DosFileAttributes
Stay organized with collections
Save and categorize content based on your preferences.
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);
Public Method Summary
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.
|
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
public
abstract
boolean
isArchive
()
Returns the value of the archive attribute.
This attribute is typically used by backup programs.
Returns
- the value of the archive attribute
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
- the value of the hidden attribute
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
- the value of the read-only attribute
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
- the value of the system attribute
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\u003eDosFileAttributes\u003c/code\u003e provides access to legacy "DOS" attributes of files, such as archive, hidden, read-only, and system properties.\u003c/p\u003e\n"],["\u003cp\u003eIt extends \u003ccode\u003eBasicFileAttributes\u003c/code\u003e, inheriting methods for accessing standard file attributes like creation time, last modified time, and file size.\u003c/p\u003e\n"],["\u003cp\u003eYou can retrieve a \u003ccode\u003eDosFileAttributes\u003c/code\u003e instance using \u003ccode\u003eFiles.readAttributes(file, DosFileAttributes.class)\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThese attributes can be used for various purposes like file management, backup operations, and understanding file visibility.\u003c/p\u003e\n"]]],["`DosFileAttributes` is an interface for accessing legacy \"DOS\" file attributes. Key actions include retrieving boolean values for `isArchive`, `isHidden`, `isReadOnly`, and `isSystem`. It also inherits methods from `BasicFileAttributes`, such as getting `creationTime`, `lastAccessTime`, `lastModifiedTime`, `size`, and checking if it is a `directory`, `symbolic link`, `regular file` or `other`. An example usage demonstrates how to read these attributes using `Files.readAttributes`.\n"],null,["# DosFileAttributes\n\npublic interface **DosFileAttributes** implements [BasicFileAttributes](../../../../../reference/java/nio/file/attribute/BasicFileAttributes.html) \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\n### Public Method Summary\n\n|------------------|----------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract boolean | [isArchive](../../../../../reference/java/nio/file/attribute/DosFileAttributes.html#isArchive())() Returns the value of the archive attribute. |\n| abstract boolean | [isHidden](../../../../../reference/java/nio/file/attribute/DosFileAttributes.html#isHidden())() Returns the value of the hidden attribute. |\n| abstract boolean | [isReadOnly](../../../../../reference/java/nio/file/attribute/DosFileAttributes.html#isReadOnly())() Returns the value of the read-only attribute. |\n| abstract boolean | [isSystem](../../../../../reference/java/nio/file/attribute/DosFileAttributes.html#isSystem())() Returns the value of the system attribute. |\n\n### Inherited Method Summary\n\nFrom interface [java.nio.file.attribute.BasicFileAttributes](../../../../../reference/java/nio/file/attribute/BasicFileAttributes.html) \n\n|-------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract FileTime | [creationTime](../../../../../reference/java/nio/file/attribute/BasicFileAttributes.html#creationTime())() Returns the creation time. |\n| abstract [Object](../../../../../reference/java/lang/Object.html) | [fileKey](../../../../../reference/java/nio/file/attribute/BasicFileAttributes.html#fileKey())() Returns an object that uniquely identifies the given file, or `null` if a file key is not available. |\n| abstract boolean | [isDirectory](../../../../../reference/java/nio/file/attribute/BasicFileAttributes.html#isDirectory())() Tells whether the file is a directory. |\n| abstract boolean | [isOther](../../../../../reference/java/nio/file/attribute/BasicFileAttributes.html#isOther())() Tells whether the file is something other than a regular file, directory, or symbolic link. |\n| abstract boolean | [isRegularFile](../../../../../reference/java/nio/file/attribute/BasicFileAttributes.html#isRegularFile())() Tells whether the file is a regular file with opaque content. |\n| abstract boolean | [isSymbolicLink](../../../../../reference/java/nio/file/attribute/BasicFileAttributes.html#isSymbolicLink())() Tells whether the file is a symbolic link. |\n| abstract FileTime | [lastAccessTime](../../../../../reference/java/nio/file/attribute/BasicFileAttributes.html#lastAccessTime())() Returns the time of last access. |\n| abstract FileTime | [lastModifiedTime](../../../../../reference/java/nio/file/attribute/BasicFileAttributes.html#lastModifiedTime())() Returns the time of last modification. |\n| abstract long | [size](../../../../../reference/java/nio/file/attribute/BasicFileAttributes.html#size())() Returns the size of the file (in bytes). |\n\nPublic Methods\n--------------\n\n#### public abstract boolean\n**isArchive**\n()\n\nReturns the value of the archive attribute.\n\nThis attribute is typically used by backup programs. \n\n##### Returns\n\n- the value of the archive attribute \n\n#### public abstract boolean\n**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##### Returns\n\n- the value of the hidden attribute \n\n#### public abstract boolean\n**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##### Returns\n\n- the value of the read-only attribute \n\n#### public abstract boolean\n**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##### Returns\n\n- the value of the system attribute"]]