public interface MemoryFileAttributeView extends BasicFileAttributeView
A MemoryFileAttributeView
is a BasicFileAttributeView
that additionally supports access to the set of in-memory attribute flags
that are used to indicate if the file is read-only, or hidden.
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:
The
Name Type readOnly Boolean
hidden Boolean
getAttribute
method may be used to read any of these attributes, or any of the attributes defined by
BasicFileAttributeView
as if by invoking the readAttributes()
method.
The setAttribute
method may be used to update the file's last modified time, last access time or create time attributes
as defined by BasicFileAttributeView
. It may also be used to update the in-memory attributes as if by invoking the
setReadOnly
, and setHidden
methods respectively.
Modifier and Type | Field and Description |
---|---|
static String |
HIDDEN
The name of the
hidden attribute. |
static String |
MEMORY_VIEW
The view name.
|
static FileAttributeViewMetadata |
METADATA
Metadata for this view.
|
static String |
READ_ONLY
The name of the
readOnly attribute. |
Modifier and Type | Method and Description |
---|---|
String |
name()
Returns the name of the attribute view.
|
MemoryFileAttributes |
readAttributes() |
void |
setHidden(boolean value)
Updates the value of the hidden attribute.
|
void |
setReadOnly(boolean value)
Updates the value of the read-only attribute.
|
setTimes
static final String MEMORY_VIEW
static final String READ_ONLY
readOnly
attribute.static final String HIDDEN
hidden
attribute.static final FileAttributeViewMetadata METADATA
String name()
"memory"
.name
in interface AttributeView
name
in interface BasicFileAttributeView
MemoryFileAttributes readAttributes() throws IOException
readAttributes
in interface BasicFileAttributeView
IOException
void setReadOnly(boolean value) throws IOException
value
- The new value of the attribute.IOException
- If an I/O error occurs.void setHidden(boolean value) throws IOException
value
- The new value of the attribute.IOException
- If an I/O error occurs.Copyright © 2016–2023. All rights reserved.