--- old/src/solaris/classes/sun/nio/fs/UnixFileSystemProvider.java 2012-11-29 01:02:54.570540495 -0800 +++ new/src/solaris/classes/sun/nio/fs/UnixFileSystemProvider.java 2012-11-29 01:02:54.410540499 -0800 @@ -509,4 +509,28 @@ }; } + /** + * It accepts a list of file type detectors as the parameter, and return + * the first {@code FileTypeDetector} that can find a file's MIME type. + * If no detectors can find the MIME type, null is returned. + * + * @param detectors List of file type detectors. + * @return The first detector that finds the file type or null. + */ + final FileTypeDetector chain(final AbstractFileTypeDetector... detectors) { + return new AbstractFileTypeDetector() { + @Override + protected String implProbeContentType(Path file) + throws IOException + { + for (AbstractFileTypeDetector detector : detectors) { + String result = detector.implProbeContentType(file); + if (result != null && !result.isEmpty()) { + return result; + } + } + return null; + } + }; + } }