use of javax.imageio.spi.ImageReaderSpi in project jdk8u_jdk by JetBrains.
the class PNGSpiStreamMetadata method main.
public static void main(String[] args) {
ImageReaderSpi rspi = new PNGImageReaderSpi();
if (rspi.getNativeStreamMetadataFormatName() != null) {
fatal();
}
if (rspi.isStandardStreamMetadataFormatSupported() != false) {
fatal();
}
if (rspi.getExtraStreamMetadataFormatNames() != null) {
fatal();
}
ImageWriterSpi wspi = new PNGImageWriterSpi();
if (wspi.getNativeStreamMetadataFormatName() != null) {
fatal();
}
if (wspi.isStandardStreamMetadataFormatSupported() != false) {
fatal();
}
if (wspi.getExtraStreamMetadataFormatNames() != null) {
fatal();
}
}
use of javax.imageio.spi.ImageReaderSpi in project jdk8u_jdk by JetBrains.
the class PluginSpiTest method testFormat.
public static void testFormat(String format) {
ImageReader reader = ImageIO.getImageReadersByFormatName(format).next();
if (reader == null) {
throw new RuntimeException("Failed to get reader for " + format);
}
ImageReaderSpi readerSpi = reader.getOriginatingProvider();
System.out.println(format + " Reader SPI: " + readerSpi);
String[] writerSpiNames = readerSpi.getImageWriterSpiNames();
if (writerSpiNames == null || writerSpiNames.length == 0) {
throw new RuntimeException("Failed to get writer spi names for " + format);
}
System.out.println("Available writer spi names:");
for (int i = 0; i < writerSpiNames.length; i++) {
System.out.println(writerSpiNames[i]);
try {
Class spiClass = Class.forName(writerSpiNames[i]);
if (spiClass == null) {
throw new RuntimeException("Failed to get spi class " + writerSpiNames[i]);
}
System.out.println("Got class " + spiClass.getName());
Object spiObject = spiClass.newInstance();
if (spiObject == null) {
throw new RuntimeException("Failed to instantiate spi " + writerSpiNames[i]);
}
System.out.println("Got instance " + spiObject);
} catch (Throwable e) {
throw new RuntimeException("Failed to test spi " + writerSpiNames[i]);
}
}
ImageWriter writer = ImageIO.getImageWriter(reader);
if (writer == null) {
throw new RuntimeException("Failed to get writer for " + format);
}
}
use of javax.imageio.spi.ImageReaderSpi in project jdk8u_jdk by JetBrains.
the class CanDecodeTest method main.
public static void main(String[] args) throws IOException {
ImageReader r = ImageIO.getImageReadersByFormatName("WBMP").next();
ImageReaderSpi spi = r.getOriginatingProvider();
Vector<TestCase> tests = getTestCases();
for (TestCase t : tests) {
t.doTest(spi);
}
System.out.println("Test passed.");
}
Aggregations