Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Methods](https://developer.android.com/reference/java/nio/file/attribute/DosFileAttributeView#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/java/nio/file/attribute/DosFileAttributeView#inhmethods)

# DosFileAttributeView

` public interface DosFileAttributeView `   
` implements https://developer.android.com/reference/java/nio/file/attribute/BasicFileAttributeView `

|---|
| java.nio.file.attribute.DosFileAttributeView |

<br />

*** ** * ** ***

A file attribute view that provides a view of the legacy "DOS" file attributes. These attributes are supported by file systems such as the File Allocation Table (FAT) format commonly used in *consumer devices*.

A `DosFileAttributeView` is a `https://developer.android.com/reference/java/nio/file/attribute/BasicFileAttributeView` that additionally supports access to the set of DOS attribute flags that are used to indicate if the file is read-only, hidden, a system file, or archived.

Where dynamic access to file attributes is required, the attributes supported by this attribute view are as defined by `BasicFileAttributeView`, and in addition, the following attributes are supported:
>
> | Name | Type |
> | readonly | `https://developer.android.com/reference/java/lang/Boolean` |
> | hidden | `https://developer.android.com/reference/java/lang/Boolean` |
> | system | `https://developer.android.com/reference/java/lang/Boolean` |
> | archive | `https://developer.android.com/reference/java/lang/Boolean` |
> |---|---|
> [Supported attributes]

The `https://developer.android.com/reference/java/nio/file/Files#getAttribute(java.nio.file.Path,%20java.lang.String,%20java.nio.file.LinkOption[])` method may be used to read any of these attributes, or any of the attributes defined by `https://developer.android.com/reference/java/nio/file/attribute/BasicFileAttributeView` as if by invoking the `https://developer.android.com/reference/java/nio/file/attribute/DosFileAttributeView#readAttributes()` method.

The `https://developer.android.com/reference/java/nio/file/Files#setAttribute(java.nio.file.Path,%20java.lang.String,%20java.lang.Object,%20java.nio.file.LinkOption[])` method may be used to update the file's last modified time, last access time or create time attributes as defined by `https://developer.android.com/reference/java/nio/file/attribute/BasicFileAttributeView`. It may also be used to update the DOS attributes as if by invoking the `https://developer.android.com/reference/java/nio/file/attribute/DosFileAttributeView#setReadOnly(boolean)`, `https://developer.android.com/reference/java/nio/file/attribute/DosFileAttributeView#setHidden(boolean)`, `https://developer.android.com/reference/java/nio/file/attribute/DosFileAttributeView#setSystem(boolean)`, and `https://developer.android.com/reference/java/nio/file/attribute/DosFileAttributeView#setArchive(boolean)` methods respectively.

## Summary

| ### Public methods ||
|---|---|
| ` abstract https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/nio/file/attribute/DosFileAttributeView#name()() ` Returns the name of the attribute view. |
| ` abstract https://developer.android.com/reference/java/nio/file/attribute/DosFileAttributes` | ` https://developer.android.com/reference/java/nio/file/attribute/DosFileAttributeView#readAttributes()() ` Reads the basic file attributes as a bulk operation. |
| ` abstract void` | ` https://developer.android.com/reference/java/nio/file/attribute/DosFileAttributeView#setArchive(boolean)(boolean value) ` Updates the value of the archive attribute. |
| ` abstract void` | ` https://developer.android.com/reference/java/nio/file/attribute/DosFileAttributeView#setHidden(boolean)(boolean value) ` Updates the value of the hidden attribute. |
| ` abstract void` | ` https://developer.android.com/reference/java/nio/file/attribute/DosFileAttributeView#setReadOnly(boolean)(boolean value) ` Updates the value of the read-only attribute. |
| ` abstract void` | ` https://developer.android.com/reference/java/nio/file/attribute/DosFileAttributeView#setSystem(boolean)(boolean value) ` Updates the value of the system attribute. |

### Inherited methods

From interface ` https://developer.android.com/reference/java/nio/file/attribute/BasicFileAttributeView ` ` abstract https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/nio/file/attribute/BasicFileAttributeView#name()() `

Returns the name of the attribute view.
` abstract https://developer.android.com/reference/java/nio/file/attribute/BasicFileAttributes` ` https://developer.android.com/reference/java/nio/file/attribute/BasicFileAttributeView#readAttributes()() `

Reads the basic file attributes as a bulk operation.
` abstract void` ` https://developer.android.com/reference/java/nio/file/attribute/BasicFileAttributeView#setTimes(java.nio.file.attribute.FileTime,%20java.nio.file.attribute.FileTime,%20java.nio.file.attribute.FileTime)(https://developer.android.com/reference/java/nio/file/attribute/FileTime lastModifiedTime, https://developer.android.com/reference/java/nio/file/attribute/FileTime lastAccessTime, https://developer.android.com/reference/java/nio/file/attribute/FileTime createTime) `

Updates any or all of the file's last modified time, last access time, and create time attributes.
From interface ` https://developer.android.com/reference/java/nio/file/attribute/AttributeView ` ` abstract https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/nio/file/attribute/AttributeView#name()() `

Returns the name of the attribute view.

## Public methods

### name

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract String name ()
```

Returns the name of the attribute view. Attribute views of this type have the name `"dos"`.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | the name of the attribute view <br /> |

### readAttributes

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract DosFileAttributes readAttributes ()
```

Reads the basic file attributes as a bulk operation.

It is implementation specific if all file attributes are read as an atomic operation with respect to other file system operations.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/nio/file/attribute/DosFileAttributes` | the file attributes <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/io/IOException` |   |
| `https://developer.android.com/reference/java/lang/SecurityException` |   |

### setArchive

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract void setArchive (boolean value)
```

Updates the value of the archive attribute.

It is implementation specific if the attribute can be updated as an atomic operation with respect to other file system operations. An implementation may, for example, require to read the existing value of the DOS attribute in order to update this attribute.

<br />

| Parameters ||
|---|---|
| `value` | `boolean`: the new value of the attribute <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/io/IOException` | if an I/O error occurs |
| `https://developer.android.com/reference/java/lang/SecurityException` | In the case of the default, and a security manager is installed, its `https://developer.android.com/reference/java/lang/SecurityManager#checkWrite(java.lang.String)` method is invoked to check write access to the file |

### setHidden

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract void setHidden (boolean value)
```

Updates the value of the hidden attribute.

It is implementation specific if the attribute can be updated as an atomic operation with respect to other file system operations. An implementation may, for example, require to read the existing value of the DOS attribute in order to update this attribute.

<br />

| Parameters ||
|---|---|
| `value` | `boolean`: the new value of the attribute <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/io/IOException` | if an I/O error occurs |
| `https://developer.android.com/reference/java/lang/SecurityException` | In the case of the default, and a security manager is installed, its `https://developer.android.com/reference/java/lang/SecurityManager#checkWrite(java.lang.String)` method is invoked to check write access to the file |

### setReadOnly

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract void setReadOnly (boolean value)
```

Updates the value of the read-only attribute.

It is implementation specific if the attribute can be updated as an atomic operation with respect to other file system operations. An implementation may, for example, require to read the existing value of the DOS attribute in order to update this attribute.

<br />

| Parameters ||
|---|---|
| `value` | `boolean`: the new value of the attribute <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/io/IOException` | if an I/O error occurs |
| `https://developer.android.com/reference/java/lang/SecurityException` | In the case of the default, and a security manager is installed, its `https://developer.android.com/reference/java/lang/SecurityManager#checkWrite(java.lang.String)` method is invoked to check write access to the file |

### setSystem

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract void setSystem (boolean value)
```

Updates the value of the system attribute.

It is implementation specific if the attribute can be updated as an atomic operation with respect to other file system operations. An implementation may, for example, require to read the existing value of the DOS attribute in order to update this attribute.

<br />

| Parameters ||
|---|---|
| `value` | `boolean`: the new value of the attribute <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/io/IOException` | if an I/O error occurs |
| `https://developer.android.com/reference/java/lang/SecurityException` | In the case of the default, and a security manager is installed, its `https://developer.android.com/reference/java/lang/SecurityManager#checkWrite(java.lang.String)` method is invoked to check write access to the file |