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/A/**
893N/A * Basic attributes associated with a file in a file system.
893N/A *
893N/A * <p> Basic file attributes are attributes that are common to many file systems
893N/A * and consist of mandatory and optional file attributes as defined by this
893N/A * interface.
893N/A *
893N/A * <p> <b>Usage Example:</b>
893N/A * <pre>
3471N/A * Path file = ...
3471N/A * BasicFileAttributes attrs = Files.readAttributes(file, BasicFileAttributes.class);
893N/A * </pre>
893N/A *
893N/A * @since 1.7
893N/A *
893N/A * @see BasicFileAttributeView
893N/A */
893N/A
893N/Apublic interface BasicFileAttributes {
893N/A
893N/A /**
893N/A * Returns the time of last modification.
893N/A *
3471N/A * <p> If the file system implementation does not support a time stamp
3471N/A * to indicate the time of last modification then this method returns an
3471N/A * implementation specific default value, typically a {@code FileTime}
3471N/A * representing the epoch (1970-01-01T00:00:00Z).
3471N/A *
1319N/A * @return a {@code FileTime} representing the time the file was last
3471N/A * modified
893N/A */
1319N/A FileTime lastModifiedTime();
893N/A
893N/A /**
3471N/A * Returns the time of last access.
893N/A *
3471N/A * <p> If the file system implementation does not support a time stamp
3471N/A * to indicate the time of last access then this method returns
3471N/A * an implementation specific default value, typically the {@link
3471N/A * #lastModifiedTime() last-modified-time} or a {@code FileTime}
3471N/A * representing the epoch (1970-01-01T00:00:00Z).
3471N/A *
3471N/A * @return a {@code FileTime} representing the time of last access
893N/A */
1319N/A FileTime lastAccessTime();
893N/A
893N/A /**
3471N/A * Returns the creation time. The creation time is the time that the file
3471N/A * was created.
893N/A *
3471N/A * <p> If the file system implementation does not support a time stamp
3471N/A * to indicate the time when the file was created then this method returns
3471N/A * an implementation specific default value, typically the {@link
3471N/A * #lastModifiedTime() last-modified-time} or a {@code FileTime}
3471N/A * representing the epoch (1970-01-01T00:00:00Z).
3471N/A *
3471N/A * @return a {@code FileTime} representing the time the file was created
893N/A */
1319N/A FileTime creationTime();
893N/A
893N/A /**
893N/A * Tells whether the file is a regular file with opaque content.
893N/A */
893N/A boolean isRegularFile();
893N/A
893N/A /**
893N/A * Tells whether the file is a directory.
893N/A */
893N/A boolean isDirectory();
893N/A
893N/A /**
1381N/A * Tells whether the file is a symbolic link.
893N/A */
893N/A boolean isSymbolicLink();
893N/A
893N/A /**
893N/A * Tells whether the file is something other than a regular file, directory,
1381N/A * or symbolic link.
893N/A */
893N/A boolean isOther();
893N/A
893N/A /**
893N/A * Returns the size of the file (in bytes). The size may differ from the
893N/A * actual size on the file system due to compression, support for sparse
893N/A * files, or other reasons. The size of files that are not {@link
893N/A * #isRegularFile regular} files is implementation specific and
893N/A * therefore unspecified.
893N/A *
908N/A * @return the file size, in bytes
893N/A */
893N/A long size();
893N/A
893N/A /**
893N/A * Returns an object that uniquely identifies the given file, or {@code
893N/A * null} if a file key is not available. On some platforms or file systems
893N/A * it is possible to use an identifier, or a combination of identifiers to
893N/A * uniquely identify a file. Such identifiers are important for operations
893N/A * such as file tree traversal in file systems that support <a
893N/A * href="../package-summary.html#links">symbolic links</a> or file systems
893N/A * that allow a file to be an entry in more than one directory. On UNIX file
893N/A * systems, for example, the <em>device ID</em> and <em>inode</em> are
893N/A * commonly used for such purposes.
893N/A *
893N/A * <p> The file key returned by this method can only be guaranteed to be
893N/A * unique if the file system and files remain static. Whether a file system
893N/A * re-uses identifiers after a file is deleted is implementation dependent and
893N/A * therefore unspecified.
893N/A *
893N/A * <p> File keys returned by this method can be compared for equality and are
893N/A * suitable for use in collections. If the file system and files remain static,
3471N/A * and two files are the {@link java.nio.file.Files#isSameFile same} with
893N/A * non-{@code null} file keys, then their file keys are equal.
893N/A *
893N/A * @see java.nio.file.Files#walkFileTree
893N/A */
893N/A Object fileKey();
893N/A}