本文整理了Java中com.drew.metadata.Directory.getStringArray()
方法的一些代码示例,展示了Directory.getStringArray()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Directory.getStringArray()
方法的具体详情如下:
包路径:com.drew.metadata.Directory
类名称:Directory
方法名:getStringArray
[英]Gets the specified tag's value as a String array, if possible. Only supported where the tag is set as StringValue[], String[], StringValue, String, int[], byte[] or Rational[].
[中]如果可能,以字符串数组的形式获取指定标记的值。仅当标记设置为StringValue[]、String[]、StringValue、String、int[]、byte[]或Rational[]时才受支持。
代码示例来源:origin: apache/tika
public void handle(Directory directory, Metadata metadata)
throws MetadataException {
if (directory.containsTag(IptcDirectory.TAG_KEYWORDS)) {
String[] keywords = directory.getStringArray(IptcDirectory.TAG_KEYWORDS);
for (String k : keywords) {
metadata.add(TikaCoreProperties.SUBJECT, k);
}
}
if (directory.containsTag(IptcDirectory.TAG_HEADLINE)) {
metadata.set(TikaCoreProperties.TITLE, directory.getString(IptcDirectory.TAG_HEADLINE));
} else if (directory.containsTag(IptcDirectory.TAG_OBJECT_NAME)) {
metadata.set(TikaCoreProperties.TITLE, directory.getString(IptcDirectory.TAG_OBJECT_NAME));
}
if (directory.containsTag(IptcDirectory.TAG_BY_LINE)) {
metadata.set(TikaCoreProperties.CREATOR, directory.getString(IptcDirectory.TAG_BY_LINE));
metadata.set(IPTC.CREATOR, directory.getString(IptcDirectory.TAG_BY_LINE));
}
if (directory.containsTag(IptcDirectory.TAG_CAPTION)) {
metadata.set(TikaCoreProperties.DESCRIPTION,
// Looks like metadata extractor returns IPTC newlines as a single carriage return,
// but the exiv2 command does not so we change to line feed here because that is less surprising to users
directory.getString(IptcDirectory.TAG_CAPTION).replaceAll("\r\n?", "\n"));
}
}
}
代码示例来源:origin: stackoverflow.com
Directory directory;
// Keywords
directory = metadata.getDirectory(IptcDirectory.class);
String keywords[] = directory.getStringArray(IptcDirectory.TAG_KEYWORDS);
// Dimensions
directory = metadata.getDirectory(JpegDirectory.class);
String height = directory.getString(JpegDirectory.TAG_JPEG_IMAGE_HEIGHT);
String width = directory.getString(JpegDirectory.TAG_JPEG_IMAGE_WIDTH);
代码示例来源:origin: org.apache.tika/tika-parsers
public void handle(Directory directory, Metadata metadata)
throws MetadataException {
if (directory.containsTag(IptcDirectory.TAG_KEYWORDS)) {
String[] keywords = directory.getStringArray(IptcDirectory.TAG_KEYWORDS);
for (String k : keywords) {
metadata.add(TikaCoreProperties.KEYWORDS, k);
}
}
if (directory.containsTag(IptcDirectory.TAG_HEADLINE)) {
metadata.set(TikaCoreProperties.TITLE, directory.getString(IptcDirectory.TAG_HEADLINE));
} else if (directory.containsTag(IptcDirectory.TAG_OBJECT_NAME)) {
metadata.set(TikaCoreProperties.TITLE, directory.getString(IptcDirectory.TAG_OBJECT_NAME));
}
if (directory.containsTag(IptcDirectory.TAG_BY_LINE)) {
metadata.set(TikaCoreProperties.CREATOR, directory.getString(IptcDirectory.TAG_BY_LINE));
metadata.set(IPTC.CREATOR, directory.getString(IptcDirectory.TAG_BY_LINE));
}
if (directory.containsTag(IptcDirectory.TAG_CAPTION)) {
metadata.set(TikaCoreProperties.DESCRIPTION,
// Looks like metadata extractor returns IPTC newlines as a single carriage return,
// but the exiv2 command does not so we change to line feed here because that is less surprising to users
directory.getString(IptcDirectory.TAG_CAPTION).replaceAll("\r\n?", "\n"));
}
}
}
代码示例来源:origin: com.github.lafa.tikaNoExternal/tika-parsers
public void handle(Directory directory, Metadata metadata)
throws MetadataException {
if (directory.containsTag(IptcDirectory.TAG_KEYWORDS)) {
String[] keywords = directory.getStringArray(IptcDirectory.TAG_KEYWORDS);
for (String k : keywords) {
metadata.add(TikaCoreProperties.KEYWORDS, k);
}
}
if (directory.containsTag(IptcDirectory.TAG_HEADLINE)) {
metadata.set(TikaCoreProperties.TITLE, directory.getString(IptcDirectory.TAG_HEADLINE));
} else if (directory.containsTag(IptcDirectory.TAG_OBJECT_NAME)) {
metadata.set(TikaCoreProperties.TITLE, directory.getString(IptcDirectory.TAG_OBJECT_NAME));
}
if (directory.containsTag(IptcDirectory.TAG_BY_LINE)) {
metadata.set(TikaCoreProperties.CREATOR, directory.getString(IptcDirectory.TAG_BY_LINE));
metadata.set(IPTC.CREATOR, directory.getString(IptcDirectory.TAG_BY_LINE));
}
if (directory.containsTag(IptcDirectory.TAG_CAPTION)) {
metadata.set(TikaCoreProperties.DESCRIPTION,
// Looks like metadata extractor returns IPTC newlines as a single carriage return,
// but the exiv2 command does not so we change to line feed here because that is less surprising to users
directory.getString(IptcDirectory.TAG_CAPTION).replaceAll("\r\n?", "\n"));
}
}
}
内容来源于网络,如有侵权,请联系作者删除!