本文整理匯總了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);
}