1564 } 1565 1566 /** 1567 * Probes the content type of a file. 1568 * 1569 * <p> This method uses the installed {@link FileTypeDetector} implementations 1570 * to probe the given file to determine its content type. Each file type 1571 * detector's {@link FileTypeDetector#probeContentType probeContentType} is 1572 * invoked, in turn, to probe the file type. If the file is recognized then 1573 * the content type is returned. If the file is not recognized by any of the 1574 * installed file type detectors then a system-default file type detector is 1575 * invoked to guess the content type. 1576 * 1577 * <p> A given invocation of the Java virtual machine maintains a system-wide 1578 * list of file type detectors. Installed file type detectors are loaded 1579 * using the service-provider loading facility defined by the {@link ServiceLoader} 1580 * class. Installed file type detectors are loaded using the system class 1581 * loader. If the system class loader cannot be found then the extension class 1582 * loader is used; If the extension class loader cannot be found then the 1583 * bootstrap class loader is used. File type detectors are typically installed 1584 * by placing them in a JAR file on the application class path or in the 1585 * extension directory, the JAR file contains a provider-configuration file 1586 * named {@code java.nio.file.spi.FileTypeDetector} in the resource directory 1587 * {@code META-INF/services}, and the file lists one or more fully-qualified 1588 * names of concrete subclass of {@code FileTypeDetector } that have a zero 1589 * argument constructor. If the process of locating or instantiating the 1590 * installed file type detectors fails then an unspecified error is thrown. 1591 * The ordering that installed providers are located is implementation 1592 * specific. 1593 * 1594 * <p> The return value of this method is the string form of the value of a 1595 * Multipurpose Internet Mail Extension (MIME) content type as 1596 * defined by <a href="http://www.ietf.org/rfc/rfc2045.txt"><i>RFC 2045: 1597 * Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet 1598 * Message Bodies</i></a>. The string is guaranteed to be parsable according 1599 * to the grammar in the RFC. 1600 * 1601 * @param path 1602 * the path to the file to probe 1603 * 1604 * @return The content type of the file, or {@code null} if the content 1605 * type cannot be determined | 1564 } 1565 1566 /** 1567 * Probes the content type of a file. 1568 * 1569 * <p> This method uses the installed {@link FileTypeDetector} implementations 1570 * to probe the given file to determine its content type. Each file type 1571 * detector's {@link FileTypeDetector#probeContentType probeContentType} is 1572 * invoked, in turn, to probe the file type. If the file is recognized then 1573 * the content type is returned. If the file is not recognized by any of the 1574 * installed file type detectors then a system-default file type detector is 1575 * invoked to guess the content type. 1576 * 1577 * <p> A given invocation of the Java virtual machine maintains a system-wide 1578 * list of file type detectors. Installed file type detectors are loaded 1579 * using the service-provider loading facility defined by the {@link ServiceLoader} 1580 * class. Installed file type detectors are loaded using the system class 1581 * loader. If the system class loader cannot be found then the extension class 1582 * loader is used; If the extension class loader cannot be found then the 1583 * bootstrap class loader is used. File type detectors are typically installed 1584 * by placing them in a JAR file on the application class path, 1585 * the JAR file contains a provider-configuration file 1586 * named {@code java.nio.file.spi.FileTypeDetector} in the resource directory 1587 * {@code META-INF/services}, and the file lists one or more fully-qualified 1588 * names of concrete subclass of {@code FileTypeDetector } that have a zero 1589 * argument constructor. If the process of locating or instantiating the 1590 * installed file type detectors fails then an unspecified error is thrown. 1591 * The ordering that installed providers are located is implementation 1592 * specific. 1593 * 1594 * <p> The return value of this method is the string form of the value of a 1595 * Multipurpose Internet Mail Extension (MIME) content type as 1596 * defined by <a href="http://www.ietf.org/rfc/rfc2045.txt"><i>RFC 2045: 1597 * Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet 1598 * Message Bodies</i></a>. The string is guaranteed to be parsable according 1599 * to the grammar in the RFC. 1600 * 1601 * @param path 1602 * the path to the file to probe 1603 * 1604 * @return The content type of the file, or {@code null} if the content 1605 * type cannot be determined |