jdk/src/solaris/classes/sun/nio/fs/UnixFileSystemProvider.java
changeset 14702 111342b28e67
parent 13571 737b7b4bd73a
child 17154 e8991539c4d7
equal deleted inserted replaced
14701:0c0578b802b1 14702:111342b28e67
   507                 return null;
   507                 return null;
   508             }
   508             }
   509         };
   509         };
   510     }
   510     }
   511 
   511 
       
   512     /**
       
   513      * Returns a {@code FileTypeDetector} that chains the given array of file
       
   514      * type detectors. When the {@code implProbeContentType} method is invoked
       
   515      * then each of the detectors is invoked in turn, the result from the
       
   516      * first to detect the file type is returned.
       
   517      */
       
   518     final FileTypeDetector chain(final AbstractFileTypeDetector... detectors) {
       
   519         return new AbstractFileTypeDetector() {
       
   520             @Override
       
   521             protected String implProbeContentType(Path file) throws IOException {
       
   522                 for (AbstractFileTypeDetector detector : detectors) {
       
   523                     String result = detector.implProbeContentType(file);
       
   524                     if (result != null && !result.isEmpty()) {
       
   525                         return result;
       
   526                     }
       
   527                 }
       
   528                 return null;
       
   529             }
       
   530         };
       
   531     }
   512 }
   532 }