Basic file attributes are attributes that are common to many file systems and consist of mandatory and optional file attributes as defined by this interface.
Usage Example:
Path file = ... BasicFileAttributes attrs = Files.readAttributes(file, BasicFileAttributes.class);
BasicFileAttributeView
| Modifier and Type | Method and Description |
|---|---|
| public FileTime | Returns: aFileTime representing the time the file was createdReturns the creation time. |
| public Object | Returns: an object that uniquely identifies the given file, ornullReturns an object that uniquely identifies the given file, or |
| public boolean | |
| public boolean | Returns: true if the file something other than a regular file,
directory or symbolic linkTells whether the file is something other than a regular file, directory, or symbolic link. |
| public boolean | Returns: true if the file is a regular file with opaque contentTells whether the file is a regular file with opaque content. |
| public boolean | Returns: true if the file is a symbolic linkTells whether the file is a symbolic link. |
| public FileTime | Returns: aFileTime representing the time of last accessReturns the time of last access. |
| public FileTime | Returns: aFileTime representing the time the file was last
modifiedReturns the time of last modification. |
| public long |
| creationTime | back to summary |
|---|---|
| public FileTime creationTime() Returns the creation time. The creation time is the time that the file was created. If the file system implementation does not support a time stamp
to indicate the time when the file was created then this method returns
an implementation specific default value, typically the
| |
| fileKey | back to summary |
|---|---|
| public Object fileKey() Returns an object that uniquely identifies the given file, or The file key returned by this method can only be guaranteed to be unique if the file system and files remain static. Whether a file system re-uses identifiers after a file is deleted is implementation dependent and therefore unspecified. File keys returned by this method can be compared for equality and are
suitable for use in collections. If the file system and files remain static,
and two files are the
| |
| isDirectory | back to summary |
|---|---|
| public boolean isDirectory() Tells whether the file is a directory.
| |
| isOther | back to summary |
|---|---|
| public boolean isOther() Tells whether the file is something other than a regular file, directory, or symbolic link.
| |
| isRegularFile | back to summary |
|---|---|
| public boolean isRegularFile() Tells whether the file is a regular file with opaque content.
| |
| isSymbolicLink | back to summary |
|---|---|
| public boolean isSymbolicLink() Tells whether the file is a symbolic link.
| |
| lastAccessTime | back to summary |
|---|---|
| public FileTime lastAccessTime() Returns the time of last access. If the file system implementation does not support a time stamp
to indicate the time of last access then this method returns
an implementation specific default value, typically the
| |
| lastModifiedTime | back to summary |
|---|---|
| public FileTime lastModifiedTime() Returns the time of last modification. If the file system implementation does not support a time stamp
to indicate the time of last modification then this method returns an
implementation specific default value, typically a
| |
| size | back to summary |
|---|---|
| public long size() Returns the size of the file (in bytes). The size may differ from the
actual size on the file system due to compression, support for sparse
files, or other reasons. The size of files that are not
| |