@Override EncodingDetector createComposite(Class<? extends EncodingDetector> encodingDetectorClass, List<EncodingDetector> childEncodingDetectors, Set<Class<? extends EncodingDetector>> excludeDetectors, Map<String, Param> params, MimeTypes mimeTypes, ServiceLoader loader) throws InvocationTargetException, IllegalAccessException, InstantiationException { EncodingDetector encodingDetector = null; Constructor<? extends EncodingDetector> c; // Try the possible default and composite detector constructors if (encodingDetector == null) { try { c = encodingDetectorClass.getConstructor(ServiceLoader.class, Collection.class); encodingDetector = c.newInstance(loader, excludeDetectors); } catch (NoSuchMethodException me) { me.printStackTrace(); } } if (encodingDetector == null) { try { c = encodingDetectorClass.getConstructor(List.class); encodingDetector = c.newInstance(childEncodingDetectors); } catch (NoSuchMethodException me) { me.printStackTrace(); } } return encodingDetector; }
@Override EncodingDetector createComposite(Class<? extends EncodingDetector> encodingDetectorClass, List<EncodingDetector> childEncodingDetectors, Set<Class<? extends EncodingDetector>> excludeDetectors, MimeTypes mimeTypes, ServiceLoader loader) throws InvocationTargetException, IllegalAccessException, InstantiationException { EncodingDetector encodingDetector = null; Constructor<? extends EncodingDetector> c; // Try the possible default and composite detector constructors if (encodingDetector == null) { try { c = encodingDetectorClass.getConstructor(ServiceLoader.class, Collection.class); encodingDetector = c.newInstance(loader, excludeDetectors); } catch (NoSuchMethodException me) { me.printStackTrace(); } } if (encodingDetector == null) { try { c = encodingDetectorClass.getConstructor(List.class); encodingDetector = c.newInstance(childEncodingDetectors); } catch (NoSuchMethodException me) { me.printStackTrace(); } } return encodingDetector; }