本文整理汇总了Java中javax.imageio.metadata.IIOMetadata.getExtraMetadataFormatNames方法的典型用法代码示例。如果您正苦于以下问题:Java IIOMetadata.getExtraMetadataFormatNames方法的具体用法?Java IIOMetadata.getExtraMetadataFormatNames怎么用?Java IIOMetadata.getExtraMetadataFormatNames使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.imageio.metadata.IIOMetadata
的用法示例。
在下文中一共展示了IIOMetadata.getExtraMetadataFormatNames方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertMetadata
import javax.imageio.metadata.IIOMetadata; //导入方法依赖的package包/类
/**
* Merges <code>inData</code> into <code>outData</code>. The supplied
* metadata format name is attempted first and failing that the standard
* metadata format name is attempted.
*/
private void convertMetadata(String metadataFormatName,
IIOMetadata inData,
IIOMetadata outData) {
String formatName = null;
String nativeFormatName = inData.getNativeMetadataFormatName();
if (nativeFormatName != null &&
nativeFormatName.equals(metadataFormatName)) {
formatName = metadataFormatName;
} else {
String[] extraFormatNames = inData.getExtraMetadataFormatNames();
if (extraFormatNames != null) {
for (int i = 0; i < extraFormatNames.length; i++) {
if (extraFormatNames[i].equals(metadataFormatName)) {
formatName = metadataFormatName;
break;
}
}
}
}
if (formatName == null &&
inData.isStandardMetadataFormatSupported()) {
formatName = STANDARD_METADATA_NAME;
}
if (formatName != null) {
try {
Node root = inData.getAsTree(formatName);
outData.mergeTree(formatName, root);
} catch(IIOInvalidTreeException e) {
// ignore
}
}
}
示例2: getMetadata
import javax.imageio.metadata.IIOMetadata; //导入方法依赖的package包/类
private IIOMetadata getMetadata(String formatName,
Set nodeNames,
boolean wantStream,
int imageIndex) throws IOException {
if (formatName == null) {
throw new IllegalArgumentException("formatName == null!");
}
if (nodeNames == null) {
throw new IllegalArgumentException("nodeNames == null!");
}
IIOMetadata metadata =
wantStream
? getStreamMetadata()
: getImageMetadata(imageIndex);
if (metadata != null) {
if (metadata.isStandardMetadataFormatSupported() &&
formatName.equals
(IIOMetadataFormatImpl.standardMetadataFormatName)) {
return metadata;
}
String nativeName = metadata.getNativeMetadataFormatName();
if (nativeName != null && formatName.equals(nativeName)) {
return metadata;
}
String[] extraNames = metadata.getExtraMetadataFormatNames();
if (extraNames != null) {
for (int i = 0; i < extraNames.length; i++) {
if (formatName.equals(extraNames[i])) {
return metadata;
}
}
}
}
return null;
}
示例3: convertMetadata
import javax.imageio.metadata.IIOMetadata; //导入方法依赖的package包/类
/**
* Merges {@code inData} into {@code outData}. The supplied
* metadata format name is attempted first and failing that the standard
* metadata format name is attempted.
*/
private void convertMetadata(String metadataFormatName,
IIOMetadata inData,
IIOMetadata outData) {
String formatName = null;
String nativeFormatName = inData.getNativeMetadataFormatName();
if (nativeFormatName != null &&
nativeFormatName.equals(metadataFormatName)) {
formatName = metadataFormatName;
} else {
String[] extraFormatNames = inData.getExtraMetadataFormatNames();
if (extraFormatNames != null) {
for (int i = 0; i < extraFormatNames.length; i++) {
if (extraFormatNames[i].equals(metadataFormatName)) {
formatName = metadataFormatName;
break;
}
}
}
}
if (formatName == null &&
inData.isStandardMetadataFormatSupported()) {
formatName = STANDARD_METADATA_NAME;
}
if (formatName != null) {
try {
Node root = inData.getAsTree(formatName);
outData.mergeTree(formatName, root);
} catch(IIOInvalidTreeException e) {
// ignore
}
}
}
示例4: getMetadata
import javax.imageio.metadata.IIOMetadata; //导入方法依赖的package包/类
private IIOMetadata getMetadata(String formatName,
Set<String> nodeNames,
boolean wantStream,
int imageIndex) throws IOException {
if (formatName == null) {
throw new IllegalArgumentException("formatName == null!");
}
if (nodeNames == null) {
throw new IllegalArgumentException("nodeNames == null!");
}
IIOMetadata metadata =
wantStream
? getStreamMetadata()
: getImageMetadata(imageIndex);
if (metadata != null) {
if (metadata.isStandardMetadataFormatSupported() &&
formatName.equals
(IIOMetadataFormatImpl.standardMetadataFormatName)) {
return metadata;
}
String nativeName = metadata.getNativeMetadataFormatName();
if (nativeName != null && formatName.equals(nativeName)) {
return metadata;
}
String[] extraNames = metadata.getExtraMetadataFormatNames();
if (extraNames != null) {
for (int i = 0; i < extraNames.length; i++) {
if (formatName.equals(extraNames[i])) {
return metadata;
}
}
}
}
return null;
}
示例5: createFromMetadata
import javax.imageio.metadata.IIOMetadata; //导入方法依赖的package包/类
/**
* Creates a {@code TIFFDirectory} instance from the contents of
* an image metadata object. The supplied object must support an image
* metadata format supported by the TIFF {@link javax.imageio.ImageWriter}
* plug-in. This will usually be either the TIFF native image metadata
* format {@code javax_imageio_tiff_image_1.0} or the Java
* Image I/O standard metadata format {@code javax_imageio_1.0}.
*
* @param tiffImageMetadata A metadata object which supports a compatible
* image metadata format.
*
* @return A {@code TIFFDirectory} populated from the contents of
* the supplied metadata object.
*
* @throws NullPointerException if {@code tiffImageMetadata}
* is {@code null}.
* @throws IllegalArgumentException if {@code tiffImageMetadata}
* does not support a compatible image metadata format.
* @throws IIOInvalidTreeException if the supplied metadata object
* cannot be parsed.
*/
public static TIFFDirectory
createFromMetadata(IIOMetadata tiffImageMetadata)
throws IIOInvalidTreeException {
if(tiffImageMetadata == null) {
throw new NullPointerException("tiffImageMetadata == null");
}
TIFFImageMetadata tim;
if(tiffImageMetadata instanceof TIFFImageMetadata) {
tim = (TIFFImageMetadata)tiffImageMetadata;
} else {
// Create a native metadata object.
ArrayList<TIFFTagSet> l = new ArrayList<TIFFTagSet>(1);
l.add(BaselineTIFFTagSet.getInstance());
tim = new TIFFImageMetadata(l);
// Determine the format name to use.
String formatName = null;
if(TIFFImageMetadata.NATIVE_METADATA_FORMAT_NAME.equals
(tiffImageMetadata.getNativeMetadataFormatName())) {
formatName = TIFFImageMetadata.NATIVE_METADATA_FORMAT_NAME;
} else {
String[] extraNames =
tiffImageMetadata.getExtraMetadataFormatNames();
if(extraNames != null) {
for(int i = 0; i < extraNames.length; i++) {
if(TIFFImageMetadata.NATIVE_METADATA_FORMAT_NAME.equals
(extraNames[i])) {
formatName = extraNames[i];
break;
}
}
}
if(formatName == null) {
if(tiffImageMetadata.isStandardMetadataFormatSupported()) {
formatName =
IIOMetadataFormatImpl.standardMetadataFormatName;
} else {
throw new IllegalArgumentException
("Parameter does not support required metadata format!");
}
}
}
// Set the native metadata object from the tree.
tim.setFromTree(formatName,
tiffImageMetadata.getAsTree(formatName));
}
return tim.getRootIFD();
}