private static ImageReader getReader() { ServiceRegistry r = IIORegistry.getDefaultInstance(); WebPImageReaderSpi s = new WebPImageReaderSpi(); r.registerServiceProvider(s); Iterator<ImageReader> readers = ImageIO.getImageReadersBySuffix("WEBP"); return (ImageReader) readers.next(); }
/** Resolve available formats */ public static Format[] getFormats() { // known? if (formats != null) return formats; // look 'em up List<Format> list = new ArrayList<Format>(10); list.add(DEFAULT); Iterator<Format> it = ServiceRegistry.lookupProviders(Format.class); while (it.hasNext()) { try { Format f = (Format) it.next(); if (!list.contains(f)) list.add(f); } catch (Throwable t) { if (t.getCause() != t) t = t.getCause(); LOG.log(Level.WARNING, "Encountered exception loading Format: " + t.getMessage()); } } // keep 'em formats = (Format[]) list.toArray(new Format[list.size()]); // done return formats; }
private static synchronized void initIfNecessary() { if (readers == null) { readers = new HashMap<String, OctaveDataReader>(); final Iterator<OctaveDataReader> sp = ServiceRegistry.lookupProviders(OctaveDataReader.class); while (sp.hasNext()) { final OctaveDataReader odr = sp.next(); readers.put(odr.octaveType(), odr); } } }
public RepairerProvider(ClassLoader classLoader, Document document) { repairers = new HashMap<String, Repairer>(); Repairer repairer; Iterator<Repairer> i = ServiceRegistry.lookupProviders(Repairer.class, classLoader); while (i.hasNext()) { repairer = i.next(); repairers.put(repairer.getIdentifier(), repairer); } try { Repairer mainRepairer = new MainRepairer(document); repairers.put(mainRepairer.getIdentifier(), mainRepairer); } catch (com.sun.star.uno.Exception e) { } }