本文整理汇总了Java中com.drew.metadata.Tag.getTagName方法的典型用法代码示例。如果您正苦于以下问题:Java Tag.getTagName方法的具体用法?Java Tag.getTagName怎么用?Java Tag.getTagName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.drew.metadata.Tag
的用法示例。
在下文中一共展示了Tag.getTagName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: printImageTags
import com.drew.metadata.Tag; //导入方法依赖的package包/类
/**
* 读取照片里面的信息
*/
private static void printImageTags(File file) throws Exception {
Metadata metadata = ImageMetadataReader.readMetadata(file);
String createDate = null;
String lat = null;
String lon = null;
for (Directory directory : metadata.getDirectories()) {
for (Tag tag : directory.getTags()) {
String tagName = tag.getTagName(); //标签名
String desc = tag.getDescription(); //标签信息
switch (tagName) {
case "Date/Time Original":
createDate = desc.split(" ")[0].replace(":", "-");
break;
case "GPS Latitude":
lat = desc;
break;
case "GPS Longitude":
lon = desc;
break;
}
}
}
moveFile(newFilePath, getposition(pointToLatlong(lat), pointToLatlong(lon)), file, createDate);
}
示例2: handle
import com.drew.metadata.Tag; //导入方法依赖的package包/类
public void handle(Directory directory, Metadata metadata)
throws MetadataException {
if (directory.getTags() != null) {
Iterator<?> tags = directory.getTags().iterator();
while (tags.hasNext()) {
Tag tag = (Tag) tags.next();
String name = tag.getTagName();
if (!MetadataFields.isMetadataField(name) && tag.getDescription() != null) {
String value = tag.getDescription().trim();
if (Boolean.TRUE.toString().equalsIgnoreCase(value)) {
value = Boolean.TRUE.toString();
} else if (Boolean.FALSE.toString().equalsIgnoreCase(value)) {
value = Boolean.FALSE.toString();
}
metadata.set(name, value);
}
}
}
}
示例3: onExtractionSuccess
import com.drew.metadata.Tag; //导入方法依赖的package包/类
@Override
public void onExtractionSuccess(@NotNull File file, @NotNull Metadata metadata, @NotNull String relativePath, @NotNull PrintStream log)
{
super.onExtractionSuccess(file, metadata, relativePath, log);
// Iterate through all values, calling toString to flush out any formatting exceptions
for (Directory directory : metadata.getDirectories()) {
directory.getName();
for (Tag tag : directory.getTags()) {
tag.getTagName();
tag.getDescription();
}
}
}
示例4: onExtracted
import com.drew.metadata.Tag; //导入方法依赖的package包/类
@Override
public void onExtracted(@NotNull File file, @NotNull Metadata metadata)
{
super.onExtracted(file, metadata);
// Iterate through all values, calling toString to flush out any formatting exceptions
for (Directory directory : metadata.getDirectories()) {
directory.getName();
for (Tag tag : directory.getTags()) {
tag.getTagName();
tag.getDescription();
}
}
}