本文整理了Java中com.drew.metadata.Directory.getString()
方法的一些代码示例,展示了Directory.getString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Directory.getString()
方法的具体详情如下:
包路径:com.drew.metadata.Directory
类名称:Directory
方法名:getString
[英]Returns the specified tag's value as a String. This value is the 'raw' value. A more presentable decoding of this value may be obtained from the corresponding Descriptor.
[中]以字符串形式返回指定标记的值。此值是“原始”值。可以从相应的描述符获得该值的更像样的解码。
代码示例来源:origin: drewnoakes/metadata-extractor
@Nullable
public String getExposureTimeDescription()
{
String value = _directory.getString(TAG_EXPOSURE_TIME);
return value == null ? null : value + " sec";
}
代码示例来源:origin: drewnoakes/metadata-extractor
String charSetName = directory.getString(IptcDirectory.TAG_CODED_CHARACTER_SET);
Charset charset = null;
try {
代码示例来源: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: drewnoakes/metadata-extractor
@Nullable
public String getRowsPerStripDescription()
{
final String value = _directory.getString(TAG_ROWS_PER_STRIP);
return value == null ? null : value + " rows/strip";
}
代码示例来源:origin: drewnoakes/metadata-extractor
@Nullable
public String getImageHeightDescription()
{
String value = _directory.getString(TAG_IMAGE_HEIGHT);
return value == null ? null : value + " pixels";
}
代码示例来源:origin: drewnoakes/metadata-extractor
@Nullable
public String getBitsPerSampleDescription()
{
String value = _directory.getString(TAG_BITS_PER_SAMPLE);
return value == null ? null : value + " bits/component/pixel";
}
代码示例来源:origin: drewnoakes/metadata-extractor
@Nullable
public String getSamplesPerPixelDescription()
{
String value = _directory.getString(TAG_SAMPLES_PER_PIXEL);
return value == null ? null : value + " samples/pixel";
}
代码示例来源:origin: drewnoakes/metadata-extractor
@Nullable
public String getInteropIndexDescription()
{
String value = _directory.getString(TAG_INTEROP_INDEX);
if (value == null)
return null;
return "R98".equalsIgnoreCase(value.trim())
? "Recommended Exif Interoperability Rules (ExifR98)"
: "Unknown (" + value + ")";
}
代码示例来源:origin: drewnoakes/metadata-extractor
@Nullable
public String getImageWidthDescription()
{
String value = _directory.getString(TAG_IMAGE_WIDTH);
return value == null ? null : value + " pixels";
}
代码示例来源:origin: drewnoakes/metadata-extractor
@Nullable
public String getStripByteCountsDescription()
{
final String value = _directory.getString(TAG_STRIP_BYTE_COUNTS);
return value == null ? null : value + " bytes";
}
代码示例来源:origin: drewnoakes/metadata-extractor
@Nullable
protected String getFormattedString(final int tagType, @NotNull final String format)
{
String value = _directory.getString(tagType);
if (value == null)
return null;
return String.format(format, value);
}
代码示例来源:origin: drewnoakes/metadata-extractor
return _directory.getString(tagType);
代码示例来源:origin: drewnoakes/metadata-extractor
/**
* A basic representation of the tag's type and value. EG: <code>[Exif IFD0] FNumber - f/2.8</code>.
*
* @return the tag's type and value
*/
@Override
@NotNull
public String toString()
{
String description = getDescription();
if (description == null)
description = _directory.getString(getTagType()) + " (unable to formulate description)";
return "[" + _directory.getName() + "] " + getTagName() + " - " + description;
}
}
代码示例来源:origin: drewnoakes/metadata-extractor
String cameraMake = ifd0Directory == null ? null : ifd0Directory.getString(ExifIFD0Directory.TAG_MAKE);
代码示例来源:origin: apache/tika
private void set(Directory directory, Metadata metadata, int extractTag, Property metadataField) {
if (directory.containsTag(extractTag)) {
Matcher m = LEADING_NUMBERS.matcher(directory.getString(extractTag));
if (m.matches()) {
metadata.set(metadataField, m.group(1));
}
}
}
}
代码示例来源:origin: apache/tika
public void handle(Directory directory, Metadata metadata) throws MetadataException {
if (directory.containsTag(JpegCommentDirectory.TAG_COMMENT)) {
metadata.add(TikaCoreProperties.COMMENTS, directory.getString(JpegCommentDirectory.TAG_COMMENT));
}
}
}
代码示例来源:origin: apache/tika
/**
* EXIF may contain image description, although with undefined encoding.
* Use IPTC for other annotation fields, and XMP for unicode support.
*/
public void handleCommentTags(Directory directory, Metadata metadata) {
if (metadata.get(TikaCoreProperties.DESCRIPTION) == null &&
directory.containsTag(ExifIFD0Directory.TAG_IMAGE_DESCRIPTION)) {
metadata.set(TikaCoreProperties.DESCRIPTION,
directory.getString(ExifIFD0Directory.TAG_IMAGE_DESCRIPTION));
}
}
代码示例来源:origin: apache/tika
metadata.set(Metadata.EXPOSURE_TIME, ((Rational) exposure).doubleValue());
} else {
metadata.set(Metadata.EXPOSURE_TIME, directory.getString(ExifSubIFDDirectory.TAG_EXPOSURE_TIME));
metadata.set(Metadata.F_NUMBER, ((Rational) fnumber).doubleValue());
} else {
metadata.set(Metadata.F_NUMBER, directory.getString(ExifSubIFDDirectory.TAG_FNUMBER));
metadata.set(Metadata.FOCAL_LENGTH, ((Rational) length).doubleValue());
} else {
metadata.set(Metadata.FOCAL_LENGTH, directory.getString(ExifSubIFDDirectory.TAG_FOCAL_LENGTH));
metadata.set(Metadata.ISO_SPEED_RATINGS, directory.getString(ExifSubIFDDirectory.TAG_ISO_EQUIVALENT));
metadata.set(Metadata.EQUIPMENT_MAKE, directory.getString(ExifIFD0Directory.TAG_MAKE));
metadata.set(Metadata.EQUIPMENT_MODEL, directory.getString(ExifIFD0Directory.TAG_MODEL));
metadata.set(Metadata.ORIENTATION, Integer.toString((Integer) length));
} else {
metadata.set(Metadata.ORIENTATION, directory.getString(ExifIFD0Directory.TAG_ORIENTATION));
metadata.set(Metadata.SOFTWARE, directory.getString(ExifIFD0Directory.TAG_SOFTWARE));
metadata.set(Metadata.RESOLUTION_HORIZONTAL, ((Rational) resolution).doubleValue());
} else {
metadata.set(Metadata.RESOLUTION_HORIZONTAL, directory.getString(ExifIFD0Directory.TAG_X_RESOLUTION));
metadata.set(Metadata.RESOLUTION_VERTICAL, ((Rational) resolution).doubleValue());
代码示例来源:origin: com.drewnoakes/metadata-extractor
@Nullable
public String getImageHeightDescription()
{
String value = _directory.getString(TAG_IMAGE_HEIGHT);
return value == null ? null : value + " pixels";
}
代码示例来源:origin: org.apache.tika/tika-parsers
/**
* EXIF may contain image description, although with undefined encoding.
* Use IPTC for other annotation fields, and XMP for unicode support.
*/
public void handleCommentTags(Directory directory, Metadata metadata) {
if (metadata.get(TikaCoreProperties.DESCRIPTION) == null &&
directory.containsTag(ExifIFD0Directory.TAG_IMAGE_DESCRIPTION)) {
metadata.set(TikaCoreProperties.DESCRIPTION,
directory.getString(ExifIFD0Directory.TAG_IMAGE_DESCRIPTION));
}
}
内容来源于网络,如有侵权,请联系作者删除!