package org.kne.codec.kif;

import javax.imageio.ImageIO;
import javax.imageio.spi.IIORegistry;
import javax.imageio.spi.ImageReaderSpi;
import javax.imageio.spi.ImageWriterSpi;

import java.util.Arrays;
import java.util.Iterator;

public class PluginTest {
    public static void main(String[] args) {
    	KIFImageReaderSpi.register(); 
    	KIFImageWriterSpi.register();
    	
        IIORegistry registry = IIORegistry.getDefaultInstance();
        // 获取所有已注册的 ImageReaderSpi
        Iterator<ImageReaderSpi> readerSPIs = registry.getServiceProviders(ImageReaderSpi.class, true);
        
        System.out.println("=== 已注册的图像读取器插件 ===");
        for (Iterator iterator = readerSPIs; iterator.hasNext();) {
			ImageReaderSpi spi = (ImageReaderSpi) iterator.next();

            System.out.println("格式: " + Arrays.toString(spi.getFormatNames()) + 
                               " | 后缀: " + Arrays.toString(spi.getFileSuffixes()));
		}
        // 获取所有已注册的 ImageReaderSpi
        Iterator<ImageWriterSpi> readerSPIsx = registry.getServiceProviders(ImageWriterSpi.class, true); 
        
        System.out.println("=== 已注册的图像写入器插件 ===");
        for (Iterator iterator = readerSPIsx; iterator.hasNext();) {
        	ImageWriterSpi spi = (ImageWriterSpi) iterator.next();

            System.out.println("格式: " + Arrays.toString(spi.getFormatNames()) + 
                               " | 后缀: " + Arrays.toString(spi.getFileSuffixes()));
		}
    
    }
}