Java Code Examples for com.drew.metadata.Directory#getErrors()
The following examples show how to use
com.drew.metadata.Directory#getErrors() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MetadataProcessor.java From FakeImageDetection with GNU General Public License v3.0 | 6 votes |
public MetadataProcessor(File imageFile) { this.imageFile = imageFile; try { data = ImageMetadataReader.readMetadata(imageFile); } catch (Exception ex) { Logger.getLogger(MetadataProcessor.class.getName()).log(Level.SEVERE, null, ex); } for (Directory directory : data.getDirectories()) { extracted_data += String.format("----------------------------------------------%15s---------------------------------\n", directory.getName()); for (Tag tag : directory.getTags()) { extracted_data += tag + "\n"; } if (directory.hasErrors()) { for (String error : directory.getErrors()) { System.err.println("ERROR: " + error); } } } }
Example 2
Source File: SampleProcessor.java From tutorials with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected void process(Record record, SingleLaneBatchMaker batchMaker) throws StageException { LOG.info("Input record: {}", record); FileRef fileRef = record.get("/fileRef").getValueAsFileRef(); Metadata metadata; try { metadata = ImageMetadataReader.readMetadata(fileRef.createInputStream(getContext(), InputStream.class)); } catch (ImageProcessingException | IOException e) { String filename = record.get("/fileInfo/filename").getValueAsString(); LOG.info("Exception getting metadata from {}", filename, e); throw new OnRecordErrorException(record, Errors.SAMPLE_02, e); } for (Directory directory : metadata.getDirectories()) { LinkedHashMap<String, Field> listMap = new LinkedHashMap<>(); for (Tag tag : directory.getTags()) { listMap.put(tag.getTagName(), Field.create(tag.getDescription())); } if (directory.hasErrors()) { for (String error : directory.getErrors()) { LOG.info("ERROR: {}", error); } } record.set("/" + directory.getName(), Field.createListMap(listMap)); } LOG.info("Output record: {}", record); batchMaker.addRecord(record); }
Example 3
Source File: ProcessAllImagesInFolderUtility.java From metadata-extractor with Apache License 2.0 | 5 votes |
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++; } } } }