当前位置: 首页>>代码示例>>Java>>正文


Java ImageReader.getOriginatingProvider方法代码示例

本文整理汇总了Java中javax.imageio.ImageReader.getOriginatingProvider方法的典型用法代码示例。如果您正苦于以下问题:Java ImageReader.getOriginatingProvider方法的具体用法?Java ImageReader.getOriginatingProvider怎么用?Java ImageReader.getOriginatingProvider使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.imageio.ImageReader的用法示例。


在下文中一共展示了ImageReader.getOriginatingProvider方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import javax.imageio.ImageReader; //导入方法依赖的package包/类
public static void main(String[] args) {
    IOException expectedException = null;
    TestStream iis = new TestStream();

    ImageReader wbmp = ImageIO.getImageReadersByFormatName("WBMP").next();
    if (wbmp == null) {
        System.out.println("No WBMP reader: skip the test");
        return;
    }

    ImageReaderSpi spi = wbmp.getOriginatingProvider();

    iis.checkPosition();

    try {
        spi.canDecodeInput(iis);
    } catch (IOException e) {
        expectedException = e;
    }

    if (expectedException == null) {
        throw new RuntimeException("Test FAILED: stream was not used");
    }

    iis.checkPosition();

    System.out.println("Test PASSED");

}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:30,代码来源:StreamResetTest.java

示例2: main

import javax.imageio.ImageReader; //导入方法依赖的package包/类
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.");
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:12,代码来源:CanDecodeTest.java

示例3: main

import javax.imageio.ImageReader; //导入方法依赖的package包/类
public static void main(String args[]) throws Exception {
    Iterator<ImageReader> readers = ImageIO.getImageReadersBySuffix("simp");
    ImageReader simpReader = null;
    if (readers.hasNext()) {
        simpReader = readers.next();
        System.out.println("reader="+simpReader);
    }
    if (simpReader == null) {
        throw new RuntimeException("Reader not found.");
    }

    ImageReaderSpi spi = simpReader.getOriginatingProvider();
    IIOMetadataFormat spiFmt =
        spi.getImageMetadataFormat("simp_metadata_1.0");
    System.out.println("fmt from SPI=" + spiFmt);

    ByteArrayInputStream bais = new ByteArrayInputStream(simpData);
    ImageInputStream iis = new MemoryCacheImageInputStream(bais);
    simpReader.setInput(iis);
    BufferedImage bi = simpReader.read(0);
    System.out.println(bi);
    IIOMetadata metadata = simpReader.getImageMetadata(0);
    System.out.println("Image metadata="+metadata);
    IIOMetadataFormat format =
        metadata.getMetadataFormat("simp_metadata_1.0");
    System.out.println("Image metadata format="+format);
    if (format == null) {
        throw new RuntimeException("MetadataFormat not found.");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:31,代码来源:TestSIMPPlugin.java

示例4: testFormat

import javax.imageio.ImageReader; //导入方法依赖的package包/类
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);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:45,代码来源:PluginSpiTest.java


注:本文中的javax.imageio.ImageReader.getOriginatingProvider方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。