893N/A/*
3909N/A * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
893N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
893N/A *
893N/A * This code is free software; you can redistribute it and/or modify it
893N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
893N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
893N/A *
893N/A * This code is distributed in the hope that it will be useful, but WITHOUT
893N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
893N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
893N/A * version 2 for more details (a copy is included in the LICENSE file that
893N/A * accompanied this code).
893N/A *
893N/A * You should have received a copy of the GNU General Public License version
893N/A * 2 along with this work; if not, write to the Free Software Foundation,
893N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
893N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
893N/A */
893N/A
893N/Apackage java.nio.file.attribute;
893N/A
893N/Aimport java.io.IOException;
893N/A
893N/A/**
893N/A * A file attribute view that provides a view of the legacy "DOS" file attributes.
893N/A * These attributes are supported by file systems such as the File Allocation
893N/A * Table (FAT) format commonly used in <em>consumer devices</em>.
893N/A *
893N/A * <p> A {@code DosFileAttributeView} is a {@link BasicFileAttributeView} that
893N/A * additionally supports access to the set of DOS attribute flags that are used
893N/A * to indicate if the file is read-only, hidden, a system file, or archived.
893N/A *
893N/A * <p> Where dynamic access to file attributes is required, the attributes
893N/A * supported by this attribute view are as defined by {@code
893N/A * BasicFileAttributeView}, and in addition, the following attributes are
893N/A * supported:
893N/A * <blockquote>
893N/A * <table border="1" cellpadding="8">
893N/A * <tr>
893N/A * <th> Name </th>
893N/A * <th> Type </th>
893N/A * </tr>
893N/A * <tr>
893N/A * <td> readonly </td>
893N/A * <td> {@link Boolean} </td>
893N/A * </tr>
893N/A * <tr>
893N/A * <td> hidden </td>
893N/A * <td> {@link Boolean} </td>
893N/A * </tr>
893N/A * <tr>
893N/A * <td> system </td>
893N/A * <td> {@link Boolean} </td>
893N/A * </tr>
893N/A * <tr>
893N/A * <td> archive </td>
893N/A * <td> {@link Boolean} </td>
893N/A * </tr>
893N/A * </table>
893N/A * </blockquote>
893N/A *
3471N/A * <p> The {@link java.nio.file.Files#getAttribute getAttribute} method may
1319N/A * be used to read any of these attributes, or any of the attributes defined by
1319N/A * {@link BasicFileAttributeView} as if by invoking the {@link #readAttributes
1319N/A * readAttributes()} method.
893N/A *
3471N/A * <p> The {@link java.nio.file.Files#setAttribute setAttribute} method may
1319N/A * be used to update the file's last modified time, last access time or create
1319N/A * time attributes as defined by {@link BasicFileAttributeView}. It may also be
1319N/A * used to update the DOS attributes as if by invoking the {@link #setReadOnly
1319N/A * setReadOnly}, {@link #setHidden setHidden}, {@link #setSystem setSystem}, and
1319N/A * {@link #setArchive setArchive} methods respectively.
893N/A *
893N/A * @since 1.7
893N/A */
893N/A
893N/Apublic interface DosFileAttributeView
893N/A extends BasicFileAttributeView
893N/A{
893N/A /**
893N/A * Returns the name of the attribute view. Attribute views of this type
893N/A * have the name {@code "dos"}.
893N/A */
893N/A @Override
893N/A String name();
893N/A
893N/A /**
893N/A * @throws IOException {@inheritDoc}
893N/A * @throws SecurityException {@inheritDoc}
893N/A */
893N/A @Override
893N/A DosFileAttributes readAttributes() throws IOException;
893N/A
893N/A /**
893N/A * Updates the value of the read-only attribute.
893N/A *
893N/A * <p> It is implementation specific if the attribute can be updated as an
893N/A * atomic operation with respect to other file system operations. An
893N/A * implementation may, for example, require to read the existing value of
893N/A * the DOS attribute in order to update this attribute.
893N/A *
893N/A * @param value
908N/A * the new value of the attribute
893N/A *
893N/A * @throws IOException
908N/A * if an I/O error occurs
893N/A * @throws SecurityException
893N/A * In the case of the default, and a security manager is installed,
893N/A * its {@link SecurityManager#checkWrite(String) checkWrite} method
893N/A * is invoked to check write access to the file
893N/A */
893N/A void setReadOnly(boolean value) throws IOException;
893N/A
893N/A /**
893N/A * Updates the value of the hidden attribute.
893N/A *
893N/A * <p> It is implementation specific if the attribute can be updated as an
893N/A * atomic operation with respect to other file system operations. An
893N/A * implementation may, for example, require to read the existing value of
893N/A * the DOS attribute in order to update this attribute.
893N/A *
893N/A * @param value
908N/A * the new value of the attribute
893N/A *
893N/A * @throws IOException
908N/A * if an I/O error occurs
893N/A * @throws SecurityException
893N/A * In the case of the default, and a security manager is installed,
893N/A * its {@link SecurityManager#checkWrite(String) checkWrite} method
893N/A * is invoked to check write access to the file
893N/A */
893N/A void setHidden(boolean value) throws IOException;
893N/A
893N/A /**
893N/A * Updates the value of the system attribute.
893N/A *
893N/A * <p> It is implementation specific if the attribute can be updated as an
893N/A * atomic operation with respect to other file system operations. An
893N/A * implementation may, for example, require to read the existing value of
893N/A * the DOS attribute in order to update this attribute.
893N/A *
893N/A * @param value
908N/A * the new value of the attribute
893N/A *
893N/A * @throws IOException
908N/A * if an I/O error occurs
893N/A * @throws SecurityException
893N/A * In the case of the default, and a security manager is installed,
893N/A * its {@link SecurityManager#checkWrite(String) checkWrite} method
893N/A * is invoked to check write access to the file
893N/A */
893N/A void setSystem(boolean value) throws IOException;
893N/A
893N/A /**
893N/A * Updates the value of the archive attribute.
893N/A *
893N/A * <p> It is implementation specific if the attribute can be updated as an
893N/A * atomic operation with respect to other file system operations. An
893N/A * implementation may, for example, require to read the existing value of
893N/A * the DOS attribute in order to update this attribute.
893N/A *
893N/A * @param value
908N/A * the new value of the attribute
893N/A *
893N/A * @throws IOException
908N/A * if an I/O error occurs
893N/A * @throws SecurityException
893N/A * In the case of the default, and a security manager is installed,
893N/A * its {@link SecurityManager#checkWrite(String) checkWrite} method
893N/A * is invoked to check write access to the file
893N/A */
893N/A void setArchive(boolean value) throws IOException;
893N/A}