當前位置: 首頁>>代碼示例>>Java>>正文


Java ImageIO.scanForPlugins方法代碼示例

本文整理匯總了Java中javax.imageio.ImageIO.scanForPlugins方法的典型用法代碼示例。如果您正苦於以下問題:Java ImageIO.scanForPlugins方法的具體用法?Java ImageIO.scanForPlugins怎麽用?Java ImageIO.scanForPlugins使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.imageio.ImageIO的用法示例。


在下文中一共展示了ImageIO.scanForPlugins方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testCreateOverviewFile

import javax.imageio.ImageIO; //導入方法依賴的package包/類
/**
 * Test method for {@link org.geoimage.viewer.widget.GeoOverviewToolbar#GeoOverviewToolbar()}.
 */
@Test
public void testCreateOverviewFile() {
	try{
		ImageIO.scanForPlugins();
		Object o=ImageIO.getImageReadersByFormatName("tiff");
		List<GeoImageReader> readers= GeoImageReaderFactory.createReaderForName(safe,PlatformConfiguration.getConfigurationInstance().getS1GeolocationAlgorithm());
		Sentinel1SLC slc=(Sentinel1SLC)(readers.get(0));
		
		Overview overview=new Overview(null);
		overview.setGir(slc);
		overview.buildOverview();
		
		assertTrue(true);
	}catch(Exception e){
		e.printStackTrace();
		assertTrue(false);
	}	
	
}
 
開發者ID:ec-europa,項目名稱:sumo,代碼行數:23,代碼來源:OverviewTest.java

示例2: write

import javax.imageio.ImageIO; //導入方法依賴的package包/類
public void write (String filename, boolean append) throws IOException {
    try {
        BufferedImage img;
        //Force the gif decoder to get registered
        Object o = com.sun.imageio.plugins.gif.GIFImageReader.class;
        ImageIO.scanForPlugins();
        
        img = ImageIO.read(new File(filename));
            write (img, append, filename);
            
    } catch (Exception ioe) {
        System.err.println("Could not write " + filename + " - " + ioe.getMessage());
        ioe.printStackTrace();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:16,代碼來源:CacheWriter.java

示例3: initIIOReadFormats

import javax.imageio.ImageIO; //導入方法依賴的package包/類
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();
        String klass = spi.getClass().getName();
        String format = spi.getFormatNames()[0].toLowerCase();
        String suffix = spi.getFileSuffixes()[0].toLowerCase();
        if (suffix == null || suffix.equals("")) {
            suffix = format;
        }
        String shortName;
        if (klass.startsWith("com.sun.imageio.plugins")) {
            shortName = "core-" + suffix;
        } else {
            shortName = "ext-" + suffix;
        }
        spis.add(spi);
        shortNames.add(shortName);
    }

    imageioReaderSpis = new ImageReaderSpi[spis.size()];
    imageioReaderSpis = (ImageReaderSpi[])spis.toArray(imageioReaderSpis);
    imageioReadFormatShortNames = new String[shortNames.size()];
    imageioReadFormatShortNames =
        (String[])shortNames.toArray(imageioReadFormatShortNames);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:36,代碼來源:InputImageTests.java

示例4: initIIOWriteFormats

import javax.imageio.ImageIO; //導入方法依賴的package包/類
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();
        String klass = spi.getClass().getName();
        String format = spi.getFormatNames()[0].toLowerCase();
        String suffix = spi.getFileSuffixes()[0].toLowerCase();
        if (suffix == null || suffix.equals("")) {
            suffix = format;
        }
        String shortName;
        if (klass.startsWith("com.sun.imageio.plugins")) {
            shortName = "core-" + suffix;
        } else {
            shortName = "ext-" + suffix;
        }
        spis.add(spi);
        shortNames.add(shortName);
    }

    imageioWriterSpis = new ImageWriterSpi[spis.size()];
    imageioWriterSpis = (ImageWriterSpi[])spis.toArray(imageioWriterSpis);
    imageioWriteFormatShortNames = new String[shortNames.size()];
    imageioWriteFormatShortNames =
        (String[])shortNames.toArray(imageioWriteFormatShortNames);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:36,代碼來源:OutputImageTests.java


注:本文中的javax.imageio.ImageIO.scanForPlugins方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。