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


Java IIOMetadataNode.getUserObject方法代码示例

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


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

示例1: COMMarkerSegment

import javax.imageio.metadata.IIOMetadataNode; //导入方法依赖的package包/类
/**
 * Constructs a marker segment from a native tree node.  If the node
 * is an <code>IIOMetadataNode</code> and contains a user object,
 * that object is used rather than the string attribute.  If the
 * string attribute is used, the default encoding is used.
 */
COMMarkerSegment(Node node) throws IIOInvalidTreeException{
    super(JPEG.COM);
    if (node instanceof IIOMetadataNode) {
        IIOMetadataNode ourNode = (IIOMetadataNode) node;
        data = (byte []) ourNode.getUserObject();
    }
    if (data == null) {
        String comment =
            node.getAttributes().getNamedItem("comment").getNodeValue();
        if (comment != null) {
            data = comment.getBytes(); // Default encoding
        } else {
            throw new IIOInvalidTreeException("Empty comment node!", node);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:COMMarkerSegment.java

示例2: COMMarkerSegment

import javax.imageio.metadata.IIOMetadataNode; //导入方法依赖的package包/类
/**
 * Constructs a marker segment from a native tree node.  If the node
 * is an {@code IIOMetadataNode} and contains a user object,
 * that object is used rather than the string attribute.  If the
 * string attribute is used, the default encoding is used.
 */
COMMarkerSegment(Node node) throws IIOInvalidTreeException{
    super(JPEG.COM);
    if (node instanceof IIOMetadataNode) {
        IIOMetadataNode ourNode = (IIOMetadataNode) node;
        data = (byte []) ourNode.getUserObject();
    }
    if (data == null) {
        String comment =
            node.getAttributes().getNamedItem("comment").getNodeValue();
        if (comment != null) {
            data = comment.getBytes(); // Default encoding
        } else {
            throw new IIOInvalidTreeException("Empty comment node!", node);
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:COMMarkerSegment.java

示例3: Qtable

import javax.imageio.metadata.IIOMetadataNode; //导入方法依赖的package包/类
Qtable(Node node) throws IIOInvalidTreeException {
    if (node.getNodeName().equals("dqtable")) {
        NamedNodeMap attrs = node.getAttributes();
        int count = attrs.getLength();
        if ((count < 1) || (count > 2)) {
            throw new IIOInvalidTreeException
                ("dqtable node must have 1 or 2 attributes", node);
        }
        elementPrecision = 0;
        tableID = getAttributeValue(node, attrs, "qtableId", 0, 3, true);
        if (node instanceof IIOMetadataNode) {
            IIOMetadataNode ourNode = (IIOMetadataNode) node;
            JPEGQTable table = (JPEGQTable) ourNode.getUserObject();
            if (table == null) {
                throw new IIOInvalidTreeException
                    ("dqtable node must have user object", node);
            }
            data = table.getTable();
        } else {
            throw new IIOInvalidTreeException
                ("dqtable node must have user object", node);
        }
    } else {
        throw new IIOInvalidTreeException
            ("Invalid node, expected dqtable", node);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:DQTMarkerSegment.java

示例4: Htable

import javax.imageio.metadata.IIOMetadataNode; //导入方法依赖的package包/类
Htable(Node node) throws IIOInvalidTreeException {
    if (node.getNodeName().equals("dhtable")) {
        NamedNodeMap attrs = node.getAttributes();
        int count = attrs.getLength();
        if (count != 2) {
            throw new IIOInvalidTreeException
                ("dhtable node must have 2 attributes", node);
        }
        tableClass = getAttributeValue(node, attrs, "class", 0, 1, true);
        tableID = getAttributeValue(node, attrs, "htableId", 0, 3, true);
        if (node instanceof IIOMetadataNode) {
            IIOMetadataNode ourNode = (IIOMetadataNode) node;
            JPEGHuffmanTable table =
                (JPEGHuffmanTable) ourNode.getUserObject();
            if (table == null) {
                throw new IIOInvalidTreeException
                    ("dhtable node must have user object", node);
            }
            numCodes = table.getLengths();
            values = table.getValues();
        } else {
            throw new IIOInvalidTreeException
                ("dhtable node must have user object", node);
        }
    } else {
        throw new IIOInvalidTreeException
            ("Invalid node, expected dqtable", node);
    }

}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:31,代码来源:DHTMarkerSegment.java

示例5: ICCMarkerSegment

import javax.imageio.metadata.IIOMetadataNode; //导入方法依赖的package包/类
ICCMarkerSegment(Node node) throws IIOInvalidTreeException {
    super(JPEG.APP2);
    if (node instanceof IIOMetadataNode) {
        IIOMetadataNode ourNode = (IIOMetadataNode) node;
        ICC_Profile prof = (ICC_Profile) ourNode.getUserObject();
        if (prof != null) {  // May be null
            profile = prof.getData();
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:JFIFMarkerSegment.java

示例6: MarkerSegment

import javax.imageio.metadata.IIOMetadataNode; //导入方法依赖的package包/类
/**
 * Construct a MarkerSegment from an "unknown" DOM Node.
 */
MarkerSegment(Node node) throws IIOInvalidTreeException {
    // The type of node should have been verified already.
    // get the attribute and assign it to the tag
    tag = getAttributeValue(node,
                            null,
                            "MarkerTag",
                            0, 255,
                            true);
    length = 0;
    // get the user object and clone it to the data
    if (node instanceof IIOMetadataNode) {
        IIOMetadataNode iioNode = (IIOMetadataNode) node;
        try {
            data = (byte []) iioNode.getUserObject();
        } catch (Exception e) {
            IIOInvalidTreeException newGuy =
                new IIOInvalidTreeException
                ("Can't get User Object", node);
            newGuy.initCause(e);
            throw newGuy;
        }
    } else {
        throw new IIOInvalidTreeException
            ("Node must have User Object", node);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:MarkerSegment.java


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