< prev index next >

src/java.base/share/classes/java/nio/file/Files.java

Print this page




1906      * </blockquote>
1907      * where square brackets [...] delineate an optional component and the
1908      * character {@code ':'} stands for itself.
1909      *
1910      * <p> <i>view-name</i> is the {@link FileAttributeView#name name} of a {@link
1911      * FileAttributeView} that identifies a set of file attributes. If not
1912      * specified then it defaults to {@code "basic"}, the name of the file
1913      * attribute view that identifies the basic set of file attributes common to
1914      * many file systems.
1915      *
1916      * <p> The <i>attribute-list</i> component is a comma separated list of
1917      * one or more names of attributes to read. If the list contains the value
1918      * {@code "*"} then all attributes are read. Attributes that are not supported
1919      * are ignored and will not be present in the returned map. It is
1920      * implementation specific if all attributes are read as an atomic operation
1921      * with respect to other file system operations.
1922      *
1923      * <p> The following examples demonstrate possible values for the {@code
1924      * attributes} parameter:
1925      *
1926      * <blockquote>
1927      * <table class="borderless">
1928      * <caption style="display:none">Possible values</caption>





1929      * <tbody>
1930      * <tr>
1931      *   <td> {@code "*"} </td>
1932      *   <td> Read all {@link BasicFileAttributes basic-file-attributes}. </td>
1933      * </tr>
1934      * <tr>
1935      *   <td> {@code "size,lastModifiedTime,lastAccessTime"} </td>
1936      *   <td> Reads the file size, last modified time, and last access time
1937      *     attributes. </td>
1938      * </tr>
1939      * <tr>
1940      *   <td> {@code "posix:*"} </td>
1941      *   <td> Read all {@link PosixFileAttributes POSIX-file-attributes}. </td>
1942      * </tr>
1943      * <tr>
1944      *   <td> {@code "posix:permissions,owner,size"} </td>
1945      *   <td> Reads the POSIX file permissions, owner, and file size. </td>
1946      * </tr>
1947      * </tbody>
1948      * </table>
1949      * </blockquote>
1950      *
1951      * <p> The {@code options} array may be used to indicate how symbolic links
1952      * are handled for the case that the file is a symbolic link. By default,
1953      * symbolic links are followed and the file attribute of the final target
1954      * of the link is read. If the option {@link LinkOption#NOFOLLOW_LINKS
1955      * NOFOLLOW_LINKS} is present then symbolic links are not followed.
1956      *
1957      * @param   path
1958      *          the path to the file
1959      * @param   attributes
1960      *          the attributes to read
1961      * @param   options
1962      *          options indicating how symbolic links are handled
1963      *
1964      * @return  a map of the attributes returned; The map's keys are the
1965      *          attribute names, its values are the attribute values
1966      *
1967      * @throws  UnsupportedOperationException
1968      *          if the attribute view is not available
1969      * @throws  IllegalArgumentException




1906      * </blockquote>
1907      * where square brackets [...] delineate an optional component and the
1908      * character {@code ':'} stands for itself.
1909      *
1910      * <p> <i>view-name</i> is the {@link FileAttributeView#name name} of a {@link
1911      * FileAttributeView} that identifies a set of file attributes. If not
1912      * specified then it defaults to {@code "basic"}, the name of the file
1913      * attribute view that identifies the basic set of file attributes common to
1914      * many file systems.
1915      *
1916      * <p> The <i>attribute-list</i> component is a comma separated list of
1917      * one or more names of attributes to read. If the list contains the value
1918      * {@code "*"} then all attributes are read. Attributes that are not supported
1919      * are ignored and will not be present in the returned map. It is
1920      * implementation specific if all attributes are read as an atomic operation
1921      * with respect to other file system operations.
1922      *
1923      * <p> The following examples demonstrate possible values for the {@code
1924      * attributes} parameter:
1925      *
1926      * <table class="striped" style="text-align: left; margin-left:2em">

1927      * <caption style="display:none">Possible values</caption>
1928      * <thead>
1929      * <tr>
1930      *  <th scope="col">Example
1931      *  <th scope="col">Description
1932      * </thead>
1933      * <tbody>
1934      * <tr>
1935      *   <th scope="row"> {@code "*"} </th>
1936      *   <td> Read all {@link BasicFileAttributes basic-file-attributes}. </td>
1937      * </tr>
1938      * <tr>
1939      *   <th scope="row"> {@code "size,lastModifiedTime,lastAccessTime"} </th>
1940      *   <td> Reads the file size, last modified time, and last access time
1941      *     attributes. </td>
1942      * </tr>
1943      * <tr>
1944      *   <th scope="row"> {@code "posix:*"} </th>
1945      *   <td> Read all {@link PosixFileAttributes POSIX-file-attributes}. </td>
1946      * </tr>
1947      * <tr>
1948      *   <th scope="row"> {@code "posix:permissions,owner,size"} </th>
1949      *   <td> Reads the POSIX file permissions, owner, and file size. </td>
1950      * </tr>
1951      * </tbody>
1952      * </table>

1953      *
1954      * <p> The {@code options} array may be used to indicate how symbolic links
1955      * are handled for the case that the file is a symbolic link. By default,
1956      * symbolic links are followed and the file attribute of the final target
1957      * of the link is read. If the option {@link LinkOption#NOFOLLOW_LINKS
1958      * NOFOLLOW_LINKS} is present then symbolic links are not followed.
1959      *
1960      * @param   path
1961      *          the path to the file
1962      * @param   attributes
1963      *          the attributes to read
1964      * @param   options
1965      *          options indicating how symbolic links are handled
1966      *
1967      * @return  a map of the attributes returned; The map's keys are the
1968      *          attribute names, its values are the attribute values
1969      *
1970      * @throws  UnsupportedOperationException
1971      *          if the attribute view is not available
1972      * @throws  IllegalArgumentException


< prev index next >