Java - File Input Output File Attributes

Introduction

java.io.File supports basic file attributes.

java.nio.attribute package contains the attribute-related classes.

Java supports the file attributes in the following six types of views.

View
Supported System
Description
BasicFileAttributeView


all platforms


manage the basic file attributes such as creation time, last access time, last modified time, size, file type (regular
file, directory, symbolic link, or other), and file key.
It can modify the creation time, the last accessed time, and the last modified time of a file.
DosFileAttributeView


on the systems
that support DOS
such as Windows.
access the file attributes that are specific to DOS.
It can check if a file is a hidden file, a system file, an archive file, and a read-only file.

PosixFileAttributeView


Unix


POSIX stands for Portable Operating System Interface for UNIX.
It extends the BasicFileAttributeView to support POSIX system such as UNIX.
It can manage owner, group, and [related access] permissions.
FileOwnerAttributeView

System supporting
file Owner
manage the owner of a file.

AclFileAttributeView

ACL File System

ACL stands for Access Control List. It is a list of permissions attached to a file.
It lets you manage the ACL for a file.
UserDefinedFileAttributeView

manage a set of user-defined attributes in the form of name-value pairs.
The name of an attribute is a String. The value of an attribute could be of any data type.

Related Topics