class CompositeFormatDetector implements Detector {

    @Override
    public Format detect(Metadata metadata, TikaInputStream inputStream) throws IOException {

        Format result = null;
        for (Detector detector : detectors) {
            result = detector.detect(metadata, inputStream);
            if (result != null)
                break;
        }
        if (result == null) {
            result = new Format(unsupportedFormatFamily, FormatUtils.DEFAULT_ENCODING);
        }
        return result;
    }

}