當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。