Examples of IIORegistry


Examples of com.google.code.appengine.imageio.spi.IIORegistry

    }

    public static IIORegistry getDefaultInstance() {
        ThreadGroup tg = Thread.currentThread().getThreadGroup();
        synchronized (instances) {
          IIORegistry instance = instances.get(tg);
          if (instance == null) {
            synchronized(IIORegistry.class) {
              instance = new IIORegistry();
            }
              instances.put(tg, instance);
          }
          return instance;
        }   
View Full Code Here

Examples of javax.imageio.spi.IIORegistry

        }

    }

    private List<WorldImageExportFormat> loadImageWriterSpis() {
        IIORegistry defaultInstance = IIORegistry.getDefaultInstance();
        Iterator<ImageWriterSpi> writers = defaultInstance.getServiceProviders(
                ImageWriterSpi.class, false);
        List<WorldImageExportFormat> formats = new ArrayList<WorldImageExportFormat>();
        while( writers.hasNext() ) {
            ImageWriterSpi writer = writers.next();
            formats.add(new WorldImageExportFormat(writer.getFormatNames()[0], writer
View Full Code Here

Examples of javax.imageio.spi.IIORegistry

public class getDefaultInstance
  implements Testlet
{
  public void test(TestHarness h)
  {
    IIORegistry registry = IIORegistry.getDefaultInstance();

    // check #1: Return valid registry.
    h.check(registry != null);
  }
View Full Code Here

Examples of javax.imageio.spi.IIORegistry

        provider = new SVGImageReaderSpi();
        registry.registerServiceProvider(provider);
    }

    protected void deactivate(final ComponentContext context) {
        IIORegistry registry = IIORegistry.getDefaultInstance();
        registry.deregisterServiceProvider(provider);
    }
View Full Code Here

Examples of javax.imageio.spi.IIORegistry

    private static void initIIOWriteFormats() {
        List spis = new ArrayList();
        List shortNames = new ArrayList();

        ImageIO.scanForPlugins();
        IIORegistry registry = IIORegistry.getDefaultInstance();
        java.util.Iterator writerspis =
            registry.getServiceProviders(ImageWriterSpi.class, false);
        while (writerspis.hasNext()) {
            // REMIND: there could be more than one non-core plugin for
            // a particular format, as is the case for JPEG2000 in the JAI
            // IIO Tools package, so we should support that somehow
            ImageWriterSpi spi = (ImageWriterSpi)writerspis.next();
View Full Code Here

Examples of javax.imageio.spi.IIORegistry

    private static void initIIOReadFormats() {
        List spis = new ArrayList();
        List shortNames = new ArrayList();

        ImageIO.scanForPlugins();
        IIORegistry registry = IIORegistry.getDefaultInstance();
        java.util.Iterator readerspis =
            registry.getServiceProviders(ImageReaderSpi.class, false);
        while (readerspis.hasNext()) {
            // REMIND: there could be more than one non-core plugin for
            // a particular format, as is the case for JPEG2000 in the JAI
            // IIO Tools package, so we should support that somehow
            ImageReaderSpi spi = (ImageReaderSpi)readerspis.next();
View Full Code Here

Examples of javax.imageio.spi.IIORegistry

    public static synchronized <T extends ImageReaderWriterSpi> void allowNativeCodec(
            final String format, final Class<T> category, final boolean allowed)
    {
        T standard = null;
        T codeclib = null;
        final IIORegistry registry = IIORegistry.getDefaultInstance();
        for (final Iterator<T> it = registry.getServiceProviders(category, false); it.hasNext();) {
            final T provider = it.next();
            final String[] formats = provider.getFormatNames();
            for (int i=0; i<formats.length; i++) {
                if (formats[i].equalsIgnoreCase(format)) {
                    if (Classes.getShortClassName(provider).startsWith("CLib")) {
                        codeclib = provider;
                    } else {
                        standard = provider;
                    }
                    break;
                }
            }
        }
        if (standard!=null && codeclib!=null) {
            if (allowed) {
                registry.setOrdering(category, codeclib, standard);
            } else {
                registry.setOrdering(category, standard, codeclib);
            }
        }
    }
View Full Code Here

Examples of javax.imageio.spi.IIORegistry

                }
            }
           
            // unload everything that JAI ImageIO can still refer to
            // We need to store them and unregister later to avoid concurrent modification exceptions
            final IIORegistry ioRegistry = IIORegistry.getDefaultInstance();
            Set<IIOServiceProvider> providersToUnload = new HashSet();
            for(Iterator<Class<?>> cats = ioRegistry.getCategories(); cats.hasNext(); ) {
                Class<?> category = cats.next();
                for (Iterator it = ioRegistry.getServiceProviders(category, false); it.hasNext();) {
                    final IIOServiceProvider provider = (IIOServiceProvider) it.next();
                    if(webappClassLoader.equals(provider.getClass().getClassLoader())) {
                        providersToUnload.add(provider);
                    }
                }
            }
            for (IIOServiceProvider provider : providersToUnload) {
                ioRegistry.deregisterServiceProvider(provider);
                LOGGER.info("Unregistering Image I/O provider " + provider);
            }
           
            // unload everything that JAI can still refer to
            final OperationRegistry opRegistry = JAI.getDefaultInstance().getOperationRegistry();
View Full Code Here

Examples of javax.imageio.spi.IIORegistry

                }
            }
           
            // unload everything that JAI ImageIO can still refer to
            // We need to store them and unregister later to avoid concurrent modification exceptions
            final IIORegistry ioRegistry = IIORegistry.getDefaultInstance();
            Set<IIOServiceProvider> providersToUnload = new HashSet();
            for(Iterator<Class<?>> cats = ioRegistry.getCategories(); cats.hasNext(); ) {
                Class<?> category = cats.next();
                for (Iterator it = ioRegistry.getServiceProviders(category, false); it.hasNext();) {
                    final IIOServiceProvider provider = (IIOServiceProvider) it.next();
                    if(webappClassLoader.equals(provider.getClass().getClassLoader())) {
                        providersToUnload.add(provider);
                    }
                }
            }
            for (IIOServiceProvider provider : providersToUnload) {
                ioRegistry.deregisterServiceProvider(provider);
                LOGGER.info("Unregistering Image I/O provider " + provider);
            }
           
            // unload everything that JAI can still refer to
            final OperationRegistry opRegistry = JAI.getDefaultInstance().getOperationRegistry();
View Full Code Here

Examples of javax.imageio.spi.IIORegistry

    // given formatName.
    public static List getJDKImageReaderWriterSPI(ServiceRegistry registry,
              String formatName,
              boolean isReader) {

  IIORegistry iioRegistry = (IIORegistry)registry;

  Class spiClass;
  String descPart;
  if (isReader) {
      spiClass = ImageReaderSpi.class;
      descPart = " image reader";
  } else {
      spiClass = ImageWriterSpi.class;
      descPart = " image writer";
  }

  Iterator iter = iioRegistry.getServiceProviders(spiClass,
              true); // useOrdering

  String formatNames[];
  ImageReaderWriterSpi provider;
  String desc = "standard " + formatName + descPart;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.