本文整理了Java中com.drew.metadata.Directory.getName()
方法的一些代码示例,展示了Directory.getName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Directory.getName()
方法的具体详情如下:
包路径:com.drew.metadata.Directory
类名称:Directory
方法名:getName
[英]Provides the name of the directory, for display purposes. E.g. Exif
[中]提供目录的名称,以便于显示。例如:Exif
代码示例来源:origin: drewnoakes/metadata-extractor
@Override
public String toString()
{
return String.format("%s Directory (%d %s)",
getName(),
_tagMap.size(),
_tagMap.size() == 1
? "tag"
: "tags");
}
}
代码示例来源:origin: drewnoakes/metadata-extractor
/**
* Get the name of the {@link com.drew.metadata.Directory} in which the tag exists, such as
* <code>Exif</code>, <code>GPS</code> or <code>Interoperability</code>.
*
* @return name of the {@link com.drew.metadata.Directory} in which this tag exists
*/
@NotNull
public String getDirectoryName()
{
return _directory.getName();
}
代码示例来源:origin: apache/nifi
private Map<String, String> getTags(Integer max, Metadata metadata) {
Map<String, String> results = new HashMap<>();
int i =0;
for (Directory directory : metadata.getDirectories()) {
for (Tag tag : directory.getTags()) {
results.put(directory.getName() + "." + tag.getTagName(), tag.getDescription());
if(max!=null) {
i++;
if (i >= max) {
return results;
}
}
}
}
return results;
}
}
代码示例来源:origin: drewnoakes/metadata-extractor
private static void writeHierarchyLevel(@NotNull Metadata metadata, @NotNull PrintWriter writer, @Nullable Directory parent, int level)
{
final int indent = 4;
for (Directory child : metadata.getDirectories()) {
if (parent == null) {
if (child.getParent() != null)
continue;
} else if (!parent.equals(child.getParent())) {
continue;
}
for (int i = 0; i < level*indent; i++) {
writer.write(' ');
}
writer.write("- ");
writer.write(child.getName());
writer.write(NEW_LINE);
writeHierarchyLevel(metadata, writer, child, level + 1);
}
}
代码示例来源:origin: drewnoakes/metadata-extractor
continue;
for (String error : directory.getErrors()) {
System.err.printf("\t[%s] %s%n", directory.getName(), error);
for (Tag tag : directory.getTags()) {
String tagName = tag.getTagName();
String directoryName = directory.getName();
String description = tag.getDescription();
代码示例来源:origin: drewnoakes/metadata-extractor
String directoryName = directory.getName();
for (Tag tag : directory.getTags()) {
String tagName = tag.getTagName();
代码示例来源:origin: drewnoakes/metadata-extractor
@Override
public void onExtractionSuccess(@NotNull File file, @NotNull Metadata metadata, @NotNull String relativePath, @NotNull PrintStream log)
{
super.onExtractionSuccess(file, metadata, relativePath, log);
for (Directory directory : metadata.getDirectories()) {
for (Tag tag : directory.getTags()) {
// Only interested in unknown tags (those without names)
if (tag.hasTagName())
continue;
HashMap<Integer, Integer> occurrenceCountByTag = _occurrenceCountByTagByDirectory.get(directory.getName());
if (occurrenceCountByTag == null) {
occurrenceCountByTag = new HashMap<Integer, Integer>();
_occurrenceCountByTagByDirectory.put(directory.getName(), occurrenceCountByTag);
}
Integer count = occurrenceCountByTag.get(tag.getTagType());
if (count == null) {
count = 0;
occurrenceCountByTag.put(tag.getTagType(), 0);
}
occurrenceCountByTag.put(tag.getTagType(), count + 1);
}
}
}
代码示例来源:origin: drewnoakes/metadata-extractor
public void onExtractionSuccess(@NotNull File file, @NotNull Metadata metadata, @NotNull String relativePath, @NotNull PrintStream log)
{
if (metadata.hasErrors()) {
log.print(file);
log.print('\n');
for (Directory directory : metadata.getDirectories()) {
if (!directory.hasErrors())
continue;
for (String error : directory.getErrors()) {
log.printf("\t[%s] %s\n", directory.getName(), error);
_errorCount++;
}
}
}
}
代码示例来源:origin: stackoverflow.com
try
{
// Extract metadata.
Metadata metadata = ImageMetadataReader.readMetadata(new BufferedInputStream(new ByteArrayInputStream(imageData)), imageData.length);
// Log each directory.
for(Directory directory : metadata.getDirectories())
{
Log.d("LOG", "Directory: " + directory.getName());
// Log all errors.
for(String error : directory.getErrors())
{
Log.d("LOG", "> error: " + error);
}
// Log all tags.
for(Tag tag : directory.getTags())
{
Log.d("LOG", "> tag: " + tag.getTagName() + " = " + tag.getDescription());
}
}
}
catch(Exception e)
{
// TODO: handle exception
}
代码示例来源: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
makernote = directory.getName().replace("Makernote", "").trim();
break;
代码示例来源:origin: drewnoakes/metadata-extractor
continue;
for (String error : directory.getErrors())
writer.format("[ERROR: %s] %s%s", directory.getName(), error, NEW_LINE);
String directoryName = directory.getName();
代码示例来源:origin: drewnoakes/metadata-extractor
@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();
}
}
}
}
代码示例来源:origin: lbalazscs/Pixelitor
public String getName() {
return dir.getName();
}
}
代码示例来源:origin: com.drewnoakes/metadata-extractor
@Override
public String toString()
{
return String.format("%s Directory (%d %s)",
getName(),
_tagMap.size(),
_tagMap.size() == 1
? "tag"
: "tags");
}
}
代码示例来源:origin: com.drewnoakes/metadata-extractor
/**
* Get the name of the {@link com.drew.metadata.Directory} in which the tag exists, such as
* <code>Exif</code>, <code>GPS</code> or <code>Interoperability</code>.
*
* @return name of the {@link com.drew.metadata.Directory} in which this tag exists
*/
@NotNull
public String getDirectoryName()
{
return _directory.getName();
}
代码示例来源:origin: perfectsense/dari
private void populateMetadata(Metadata metadata) {
for (Iterator<?> di = metadata.getDirectories().iterator(); di.hasNext();) {
Directory directory = (Directory) di.next();
Map<String, String> tags = new HashMap<String, String>();
put(directory.getName(), tags);
for (Iterator<?> ti = directory.getTags().iterator(); ti.hasNext();) {
Tag tag = (Tag) ti.next();
try {
tags.put(tag.getTagName(), directory.getDescription(tag.getTagType()));
} catch (Exception error) {
errors.add(error);
}
}
}
}
代码示例来源:origin: com.drewnoakes/metadata-extractor
public void onExtractionSuccess(@NotNull File file, @NotNull Metadata metadata, @NotNull String relativePath, @NotNull PrintStream log)
{
if (metadata.hasErrors()) {
log.print(file);
log.print('\n');
for (Directory directory : metadata.getDirectories()) {
if (!directory.hasErrors())
continue;
for (String error : directory.getErrors()) {
log.printf("\t[%s] %s\n", directory.getName(), error);
_errorCount++;
}
}
}
}
代码示例来源:origin: com.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: com.drewnoakes/metadata-extractor
@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();
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!