當前位置: 首頁>>代碼示例>>Java>>正文


Java ImageReaderSpi.getExtraStreamMetadataFormatNames方法代碼示例

本文整理匯總了Java中javax.imageio.spi.ImageReaderSpi.getExtraStreamMetadataFormatNames方法的典型用法代碼示例。如果您正苦於以下問題:Java ImageReaderSpi.getExtraStreamMetadataFormatNames方法的具體用法?Java ImageReaderSpi.getExtraStreamMetadataFormatNames怎麽用?Java ImageReaderSpi.getExtraStreamMetadataFormatNames使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.imageio.spi.ImageReaderSpi的用法示例。


在下文中一共展示了ImageReaderSpi.getExtraStreamMetadataFormatNames方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: main

import javax.imageio.spi.ImageReaderSpi; //導入方法依賴的package包/類
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();
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:24,代碼來源:PNGSpiStreamMetadata.java

示例2: main

import javax.imageio.spi.ImageReaderSpi; //導入方法依賴的package包/類
public static void main(String[] args) {
    IIOMetadataFormat format = null;
    if (args.length == 0 || args[0].equals("javax_imageio_1.0")) {
        format = IIOMetadataFormatImpl.getStandardFormatInstance();
    } else {
        IIORegistry registry = IIORegistry.getDefaultInstance();
        Iterator iter = registry.getServiceProviders(ImageReaderSpi.class,
                                                     false);
        while (iter.hasNext()) {
            ImageReaderSpi spi = (ImageReaderSpi)iter.next();
            if (args[0].equals
                (spi.getNativeStreamMetadataFormatName())) {
                System.out.print(spi.getDescription(null));
                System.out.println(": native stream format");
                format = spi.getStreamMetadataFormat(args[0]);
                break;
            }

            String[] extraStreamFormatNames =
                spi.getExtraStreamMetadataFormatNames();
            if (extraStreamFormatNames != null &&
                Arrays.asList(extraStreamFormatNames).
                contains(args[0])) {
                System.out.print(spi.getDescription(null));
                System.out.println(": extra stream format");
                format = spi.getStreamMetadataFormat(args[0]);
                break;
            }

            if (args[0].equals
                (spi.getNativeImageMetadataFormatName())) {
                System.out.print(spi.getDescription(null));
                System.out.println(": native image format");
                format = spi.getImageMetadataFormat(args[0]);
                break;
            }

            String[] extraImageFormatNames =
                spi.getExtraImageMetadataFormatNames();
            if (extraImageFormatNames != null &&
                Arrays.asList(extraImageFormatNames).contains(args[0])) {
                System.out.print(spi.getDescription(null));
                System.out.println(": extra image format");
                format = spi.getImageMetadataFormat(args[0]);
                break;
            }
        }
    }

    if (format == null) {
        System.err.println("Unknown format: " + args[0]);
        System.exit(0);
    }

    MetadataFormatPrinter printer = new MetadataFormatPrinter(System.out);
    printer.print(format);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:58,代碼來源:MetadataFormatPrinter.java

示例3: main

import javax.imageio.spi.ImageReaderSpi; //導入方法依賴的package包/類
public static void main(String[] args) {
    fmts = new Hashtable();

    fmts.put("javax_imageio_jpeg_stream_1.0", Boolean.FALSE);
    fmts.put("javax_imageio_jpeg_image_1.0",  Boolean.FALSE);
    fmts.put("javax_imageio_png_1.0",         Boolean.FALSE);
    fmts.put("javax_imageio_bmp_1.0",         Boolean.FALSE);
    fmts.put("javax_imageio_wbmp_1.0",        Boolean.FALSE);
    fmts.put("javax_imageio_gif_stream_1.0",  Boolean.FALSE);
    fmts.put("javax_imageio_gif_image_1.0",   Boolean.FALSE);

    IIORegistry registry = IIORegistry.getDefaultInstance();
    Iterator iter = registry.getServiceProviders(ImageReaderSpi.class,
                                                 false);
    while(iter.hasNext()) {
        ImageReaderSpi spi = (ImageReaderSpi)iter.next();
        String fmt_name;
        fmt_name = spi.getNativeStreamMetadataFormatName();
        testStreamMetadataFormat(spi, fmt_name);

        fmt_name = spi.getNativeImageMetadataFormatName();
        testImageMetadataFormat(spi, fmt_name);

        String[] fmt_names;
        fmt_names = spi.getExtraStreamMetadataFormatNames();
        for (int i=0; fmt_names != null && i < fmt_names.length; i++) {
            testStreamMetadataFormat(spi, fmt_names[i]);
        }

        fmt_names = spi.getExtraImageMetadataFormatNames();
        for (int i=0; fmt_names != null && i < fmt_names.length; i++) {
            testImageMetadataFormat(spi, fmt_names[i]);
        }
    }
    Enumeration keys = fmts.keys();
    while (keys.hasMoreElements()) {
        String key = (String)keys.nextElement();
        boolean val = ((Boolean)fmts.get(key)).booleanValue();
        if (!val) {
            throw new RuntimeException("Test failed: format " +
                                       key + "is not registered.");
        }
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:45,代碼來源:RegisteredFormatsTest.java

示例4: testImageReaderSpiConstructor

import javax.imageio.spi.ImageReaderSpi; //導入方法依賴的package包/類
public void testImageReaderSpiConstructor() {
    resetConstructorArguments();

    checkImageReaderSpiConstructor(true);
    vendorName = "My Vendor";
    checkImageReaderSpiConstructor(true);
    version = "My Version";
    checkImageReaderSpiConstructor(true);
    names = new String[0];
    checkImageReaderSpiConstructor(true);
    names = new String[1];
    names[0] = "My Format Name";
    checkImageReaderSpiConstructor(true);
    readerClassName = "com.mycompany.Reader";
    checkImageReaderSpiConstructor(true);
    inputTypes = new Class[0];
    checkImageReaderSpiConstructor(true);
    inputTypes = new Class[1];
    inputTypes[0] = Object.class;
    // Now it should work
    checkImageReaderSpiConstructor(false);

    // Test normalization of zero-length arrays
    suffixes = new String[0];
    MIMETypes = new String[0];
    writerSpiNames = new String[0];
    extraStreamMetadataFormatNames = new String[0];
    extraImageMetadataFormatNames = new String[0];

    ImageReaderSpi spi = constructImageReaderSpi();
    if (spi.getFileSuffixes() != null) {
        error("Failed to normalize suffixes!");
    }
    if (spi.getMIMETypes() != null) {
        error("Failed to normalize MIMETypes!");
    }
    if (spi.getImageWriterSpiNames() != null) {
        error("Failed to normalize writerSpiNames!");
    }
    if (spi.getExtraStreamMetadataFormatNames() != null) {
        error("Failed to normalize extraStreamMetadataFormatNames!");
    }
    if (spi.getExtraImageMetadataFormatNames() != null) {
        error("Failed to normalize extraImageMetadataFormatNames!");
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:47,代碼來源:SpiTest.java


注:本文中的javax.imageio.spi.ImageReaderSpi.getExtraStreamMetadataFormatNames方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。