本文整理汇总了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);
}
}
示例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();
}
}
示例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);
}
示例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);
}