diff -r 0c0578b802b1 -r 111342b28e67 jdk/src/solaris/classes/sun/nio/fs/UnixFileSystemProvider.java --- a/jdk/src/solaris/classes/sun/nio/fs/UnixFileSystemProvider.java Mon Dec 03 11:07:20 2012 -0500 +++ b/jdk/src/solaris/classes/sun/nio/fs/UnixFileSystemProvider.java Tue Dec 04 14:07:30 2012 +0000 @@ -509,4 +509,24 @@ }; } + /** + * Returns a {@code FileTypeDetector} that chains the given array of file + * type detectors. When the {@code implProbeContentType} method is invoked + * then each of the detectors is invoked in turn, the result from the + * first to detect the file type is returned. + */ + 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; + } + }; + } }