本文整理匯總了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();
}