本文整理汇总了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);
}
}
}
示例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);
}
}
}
示例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);
}
}
示例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);
}
}
示例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();
}
}
}
示例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);
}
}