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


Java ImageIO.getImageReadersBySuffix方法代码示例

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


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

示例1: testGetReaderFileSuffixes

import javax.imageio.ImageIO; //导入方法依赖的package包/类
private static void testGetReaderFileSuffixes() {
    String[] suffixes = ImageIO.getReaderFileSuffixes();
    for (String s : suffixes) {
        Iterator<ImageReader> it = ImageIO.getImageReadersBySuffix(s);
        if (!it.hasNext()) {
            throw new RuntimeException("getReaderFileSuffixes returned " +
                                       "an unknown suffix: " + s);
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:GetReaderWriterInfo.java

示例2: main

import javax.imageio.ImageIO; //导入方法依赖的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

示例3: testReaderIsRegistered

import javax.imageio.ImageIO; //导入方法依赖的package包/类
@Test
public void testReaderIsRegistered() {
  Supplier<Iterator<ImageReader>> getReaderIter = () -> ImageIO.getImageReadersBySuffix("jpg");
  assertThat(getReaderIter.get()).isNotEmpty();
  assertThat(getReaderIter.get()).hasAtLeastOneElementOfType(TurboJpegImageReader.class);
  getReaderIter = () -> ImageIO.getImageReadersByMIMEType("image/jpeg");
  assertThat(getReaderIter.get()).isNotEmpty();
  assertThat(getReaderIter.get()).hasAtLeastOneElementOfType(TurboJpegImageReader.class);
  getReaderIter = () -> ImageIO.getImageReadersByFormatName("jpeg");
  assertThat(getReaderIter.get()).isNotEmpty();
  assertThat(getReaderIter.get()).hasAtLeastOneElementOfType(TurboJpegImageReader.class);
}
 
开发者ID:dbmdz,项目名称:imageio-jnr,代码行数:13,代码来源:TurboJpegImageReaderTest.java


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