68 * </tr> 69 * <tr> 70 * <td> "isDirectory" </td> 71 * <td> {@link Boolean} </td> 72 * </tr> 73 * <tr> 74 * <td> "isSymbolicLink" </td> 75 * <td> {@link Boolean} </td> 76 * </tr> 77 * <tr> 78 * <td> "isOther" </td> 79 * <td> {@link Boolean} </td> 80 * </tr> 81 * <tr> 82 * <td> "fileKey" </td> 83 * <td> {@link Object} </td> 84 * </tr> 85 * </table> 86 * </blockquote> 87 * 88 * <p> The {@link java.nio.file.FileRef#getAttribute getAttribute} method may be 89 * used to read any of these attributes as if by invoking the {@link 90 * #readAttributes() readAttributes()} method. 91 * 92 * <p> The {@link java.nio.file.FileRef#setAttribute setAttribute} method may be 93 * used to update the file's last modified time, last access time or create time 94 * attributes as if by invoking the {@link #setTimes setTimes} method. 95 * 96 * @since 1.7 97 * @see Attributes 98 */ 99 100 public interface BasicFileAttributeView 101 extends FileAttributeView 102 { 103 /** 104 * Returns the name of the attribute view. Attribute views of this type 105 * have the name {@code "basic"}. 106 */ 107 @Override 108 String name(); 109 110 /** 111 * Reads the basic file attributes as a bulk operation. 112 * 113 * <p> It is implementation specific if all file attributes are read as an 114 * atomic operation with respect to other file system operations. 115 * 116 * @return the file attributes 117 * 118 * @throws IOException 119 * if an I/O error occurs 120 * @throws SecurityException 121 * In the case of the default provider, a security manager is 122 * installed, its {@link SecurityManager#checkRead(String) checkRead} 123 * method is invoked to check read access to the file 124 */ 125 BasicFileAttributes readAttributes() throws IOException; 126 127 /** 128 * Updates any or all of the file's last modified time, last access time, 129 * and create time attributes. 130 * 131 * <p> This method updates the file's timestamp attributes. The values are 132 * converted to the epoch and precision supported by the file system. 133 * Converting from finer to coarser granularities result in precision loss. 134 * The behavior of this method when attempting to set a timestamp to a value 135 * that is outside the range supported by the underlying file store is not 136 * defined. It may or not fail by throwing an {@code IOException}. 137 * 138 * <p> If any of the {@code lastModifiedTime}, {@code lastAccessTime}, 139 * or {@code createTime} parameters has the value {@code null} then the 140 * corresponding timestamp is not changed. An implementation may require to 141 * read the existing values of the file attributes when only some, but not 142 * all, of the timestamp attributes are updated. Consequently, this method 143 * may not be an atomic operation with respect to other file system 144 * operations. Reading and re-writing existing values may also result in 145 * precision loss. If all of the {@code lastModifiedTime}, {@code 146 * lastAccessTime} and {@code createTime} parameters are {@code null} then 147 * this method has no effect. 148 * 149 * @param lastModifiedTime 150 * the new last modified time, or {@code null} to not change the 151 * value 152 * @param lastAccessTime 153 * the last access time, or {@code null} to not change the value 154 * @param createTime 155 * the file's create time, or {@code null} to not change the value 156 * | 68 * </tr> 69 * <tr> 70 * <td> "isDirectory" </td> 71 * <td> {@link Boolean} </td> 72 * </tr> 73 * <tr> 74 * <td> "isSymbolicLink" </td> 75 * <td> {@link Boolean} </td> 76 * </tr> 77 * <tr> 78 * <td> "isOther" </td> 79 * <td> {@link Boolean} </td> 80 * </tr> 81 * <tr> 82 * <td> "fileKey" </td> 83 * <td> {@link Object} </td> 84 * </tr> 85 * </table> 86 * </blockquote> 87 * 88 * <p> The {@link java.nio.file.Files#getAttribute getAttribute} method may be 89 * used to read any of these attributes as if by invoking the {@link 90 * #readAttributes() readAttributes()} method. 91 * 92 * <p> The {@link java.nio.file.Files#setAttribute setAttribute} method may be 93 * used to update the file's last modified time, last access time or create time 94 * attributes as if by invoking the {@link #setTimes setTimes} method. 95 * 96 * @since 1.7 97 */ 98 99 public interface BasicFileAttributeView 100 extends FileAttributeView 101 { 102 /** 103 * Returns the name of the attribute view. Attribute views of this type 104 * have the name {@code "basic"}. 105 */ 106 @Override 107 String name(); 108 109 /** 110 * Reads the basic file attributes as a bulk operation. 111 * 112 * <p> It is implementation specific if all file attributes are read as an 113 * atomic operation with respect to other file system operations. 114 * 115 * @return the file attributes 116 * 117 * @throws IOException 118 * if an I/O error occurs 119 * @throws SecurityException 120 * In the case of the default provider, a security manager is 121 * installed, its {@link SecurityManager#checkRead(String) checkRead} 122 * method is invoked to check read access to the file 123 */ 124 BasicFileAttributes readAttributes() throws IOException; 125 126 /** 127 * Updates any or all of the file's last modified time, last access time, 128 * and create time attributes. 129 * 130 * <p> This method updates the file's timestamp attributes. The values are 131 * converted to the epoch and precision supported by the file system. 132 * Converting from finer to coarser granularities result in precision loss. 133 * The behavior of this method when attempting to set a timestamp that is 134 * not supported or to a value that is outside the range supported by the 135 * underlying file store is not defined. It may or not fail by throwing an 136 * {@code IOException}. 137 * 138 * <p> If any of the {@code lastModifiedTime}, {@code lastAccessTime}, 139 * or {@code createTime} parameters has the value {@code null} then the 140 * corresponding timestamp is not changed. An implementation may require to 141 * read the existing values of the file attributes when only some, but not 142 * all, of the timestamp attributes are updated. Consequently, this method 143 * may not be an atomic operation with respect to other file system 144 * operations. Reading and re-writing existing values may also result in 145 * precision loss. If all of the {@code lastModifiedTime}, {@code 146 * lastAccessTime} and {@code createTime} parameters are {@code null} then 147 * this method has no effect. 148 * 149 * @param lastModifiedTime 150 * the new last modified time, or {@code null} to not change the 151 * value 152 * @param lastAccessTime 153 * the last access time, or {@code null} to not change the value 154 * @param createTime 155 * the file's create time, or {@code null} to not change the value 156 * |