• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java IIOMetadataFormatImpl类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



IIOMetadataFormatImpl类属于javax.imageio.metadata包,在下文中一共展示了IIOMetadataFormatImpl类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getAsTree

import javax.imageio.metadata.IIOMetadataFormatImpl; //导入依赖的package包/类
public Node getAsTree(String formatName) {
    if (formatName == null) {
        throw new IllegalArgumentException("null formatName!");
    }
    if (isStream) {
        if (formatName.equals(JPEG.nativeStreamMetadataFormatName)) {
            return getNativeTree();
        }
    } else {
        if (formatName.equals(JPEG.nativeImageMetadataFormatName)) {
            return getNativeTree();
        }
        if (formatName.equals
                (IIOMetadataFormatImpl.standardMetadataFormatName)) {
            return getStandardTree();
        }
    }
    throw  new IllegalArgumentException("Unsupported format name: "
                                            + formatName);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:JPEGMetadata.java


示例2: setFromTree

import javax.imageio.metadata.IIOMetadataFormatImpl; //导入依赖的package包/类
public void setFromTree(String formatName, Node root)
    throws IIOInvalidTreeException {
    if (formatName == null) {
        throw new IllegalArgumentException("null formatName!");
    }
    if (root == null) {
        throw new IllegalArgumentException("null root!");
    }
    if (isStream &&
        (formatName.equals(JPEG.nativeStreamMetadataFormatName))) {
        setFromNativeTree(root);
    } else if (!isStream &&
               (formatName.equals(JPEG.nativeImageMetadataFormatName))) {
        setFromNativeTree(root);
    } else if (!isStream &&
               (formatName.equals
                (IIOMetadataFormatImpl.standardMetadataFormatName))) {
        // In this case a reset followed by a merge is correct
        super.setFromTree(formatName, root);
    } else {
        throw  new IllegalArgumentException("Unsupported format name: "
                                            + formatName);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:JPEGMetadata.java


示例3: mergeTree

import javax.imageio.metadata.IIOMetadataFormatImpl; //导入依赖的package包/类
public void mergeTree(String formatName, Node root)
  throws IIOInvalidTreeException {
    if (formatName.equals(nativeMetadataFormatName)) {
        if (root == null) {
            throw new IllegalArgumentException("root == null!");
        }
        mergeNativeTree(root);
    } else if (formatName.equals
              (IIOMetadataFormatImpl.standardMetadataFormatName)) {
        if (root == null) {
            throw new IllegalArgumentException("root == null!");
        }
        mergeStandardTree(root);
    } else {
        throw new IllegalArgumentException("Not a recognized format!");
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:GIFMetadata.java


示例4: mergeTree

import javax.imageio.metadata.IIOMetadataFormatImpl; //导入依赖的package包/类
public void mergeTree(String formatName, Node root)
  throws IIOInvalidTreeException {
    if (formatName.equals(nativeMetadataFormatName)) {
        if (root == null) {
            throw new IllegalArgumentException("root == null!");
        }
        mergeNativeTree(root);
    } else if (formatName.equals
               (IIOMetadataFormatImpl.standardMetadataFormatName)) {
        if (root == null) {
            throw new IllegalArgumentException("root == null!");
        }
        mergeStandardTree(root);
    } else {
        throw new IllegalArgumentException("Not a recognized format!");
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:GIFWritableStreamMetadata.java


示例5: mergeTree

import javax.imageio.metadata.IIOMetadataFormatImpl; //导入依赖的package包/类
public void mergeTree(String formatName, Node root)
    throws IIOInvalidTreeException {
    if (formatName.equals(nativeMetadataFormatName)) {
        if (root == null) {
            throw new IllegalArgumentException("root == null!");
        }
        mergeNativeTree(root);
    } else if (formatName.equals
               (IIOMetadataFormatImpl.standardMetadataFormatName)) {
        if (root == null) {
            throw new IllegalArgumentException("root == null!");
        }
        mergeStandardTree(root);
    } else {
        throw new IllegalArgumentException("Not a recognized format!");
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:PNGMetadata.java


示例6: convertStandardImageMetadata

import javax.imageio.metadata.IIOMetadataFormatImpl; //导入依赖的package包/类
/**
 * Converts a standard {@code javax_imageio_1.0} tree to a
 * {@code TIFFImageMetadata} object.
 *
 * @param inData The metadata object.
 * @return a {@code TIFFImageMetadata} or {@code null} if
 * the standard tree derived from the input object is {@code null}.
 * @throws IllegalArgumentException if {@code inData} is
 * {@code null}.
 * @throws IllegalArgumentException if {@code inData} does not support
 * the standard metadata format.
 * @throws IIOInvalidTreeException if {@code inData} generates an
 * invalid standard metadata tree.
 */
private TIFFImageMetadata convertStandardImageMetadata(IIOMetadata inData)
    throws IIOInvalidTreeException {

    if(inData == null) {
        throw new NullPointerException("inData == null!");
    } else if(!inData.isStandardMetadataFormatSupported()) {
        throw new IllegalArgumentException
            ("inData does not support standard metadata format!");
    }

    TIFFImageMetadata outData = null;

    String formatName = IIOMetadataFormatImpl.standardMetadataFormatName;
    Node tree = inData.getAsTree(formatName);
    if (tree != null) {
        List<TIFFTagSet> tagSets = new ArrayList<TIFFTagSet>(1);
        tagSets.add(BaselineTIFFTagSet.getInstance());
        outData = new TIFFImageMetadata(tagSets);
        outData.setFromTree(formatName, tree);
    }

    return outData;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:38,代码来源:TIFFImageWriter.java


示例7: mergeTree

import javax.imageio.metadata.IIOMetadataFormatImpl; //导入依赖的package包/类
public void mergeTree(String formatName, Node root)
    throws IIOInvalidTreeException{
    if (formatName.equals(nativeMetadataFormatName)) {
        if (root == null) {
            throw new NullPointerException("root == null!");
        }
        mergeNativeTree(root);
    } else if (formatName.equals
               (IIOMetadataFormatImpl.standardMetadataFormatName)) {
        if (root == null) {
            throw new NullPointerException("root == null!");
        }
        mergeStandardTree(root);
    } else {
        throw new IllegalArgumentException("Not a recognized format!");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:TIFFImageMetadata.java


示例8: main

import javax.imageio.metadata.IIOMetadataFormatImpl; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
    // Generate some trivial image and save it to a temporary array
    ByteArrayOutputStream tmp = new ByteArrayOutputStream();
    ImageIO.write(new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB),
            "gif", tmp);

    // Read the stream
    ImageInputStream in = new MemoryCacheImageInputStream(
            new ByteArrayInputStream(tmp.toByteArray()));
    ImageReader reader = ImageIO.getImageReaders(in).next();
    reader.setInput(in);

    // Retrieve standard image metadata tree
    IIOMetadata meta = reader.getImageMetadata(0);
    if (meta == null || !meta.isStandardMetadataFormatSupported()) {
        throw new Error("Test failure: Missing metadata");
    }
    Element root = (Element) meta.
            getAsTree(IIOMetadataFormatImpl.standardMetadataFormatName);

    // Test getElementsByTagName("*")
    if (root.getElementsByTagName("*").getLength() == 0) {
        throw new RuntimeException("getElementsByTagName(\"*\") returns"
                + " nothing");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:GetElementsByTagNameTest.java


示例9: main

import javax.imageio.metadata.IIOMetadataFormatImpl; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
    String fileName = "nomarkers.jpg";
    String sep = System.getProperty("file.separator");
    String dir = System.getProperty("test.src", ".");
    String filePath = dir+sep+fileName;
    System.out.println("Test file: " + filePath);
    File file = new File(filePath);
    ImageInputStream stream = ImageIO.createImageInputStream(file);
    Iterator<ImageReader> readers = ImageIO.getImageReaders(stream);

    if(readers.hasNext()) {
        ImageReader reader = readers.next();
        reader.setInput(stream);
        IIOMetadata metadata = reader.getImageMetadata(0);

        IIOMetadataNode standardTree = (IIOMetadataNode)
            metadata.getAsTree
            (IIOMetadataFormatImpl.standardMetadataFormatName);
        IIOMetadataNode colorSpaceType = (IIOMetadataNode)
            standardTree.getElementsByTagName("ColorSpaceType").item(0);
        String colorSpaceName = colorSpaceType.getAttribute("name");
        if(colorSpaceName.equals("RGB"))
            throw new RuntimeException("Identified incorrect ColorSpace");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:JpegMetadataColorSpaceTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TableListModel类代码示例发布时间:2022-05-21
下一篇:
Java ScheduledAction类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap