Package com.drew.metadata

Examples of com.drew.metadata.Tag


    if(orie!=1)
      System.out.println(jpegFile.getName()+":"+orie);
   
      Iterator tags = exif.getTagIterator();
      while (tags.hasNext()) {
          Tag tag = (Tag)tags.next();
          // use Tag.toString()
          System.out.println(tag);
      }
  }
View Full Code Here


                while (directories.hasNext()) {
                    Directory directory = directories.next();
                    @SuppressWarnings("unchecked")
                    Iterator<Tag> tags = directory.getTagIterator();
                    while (tags.hasNext()) {
                        Tag tag = tags.next();
                        try {
                            props.put(tag.getTagName(), tag.getDescription());
                            ii.info.append(tag.getTagName() + ": " + tag.getDescription() + " .\n");
                        } catch (MetadataException e) {
                            //Log.logException(e);
                        }
                    }
                    title = props.get("Image Description");
View Full Code Here

            while (directories.hasNext()) {
                Directory directory = (Directory) directories.next();
                Iterator<?> tags = directory.getTagIterator();

                while (tags.hasNext()) {
                    Tag tag = (Tag)tags.next();
                    metadata.set(tag.getTagName(), tag.getDescription());
                }
            }
        } catch (JpegProcessingException e) {
            throw new TikaException("Can't read JPEG metadata", e);
        } catch (MetadataException e) {
View Full Code Here

    }
   
    @Test
    public void testCopyUnknownFieldsHandler() throws MetadataException {
        Directory d = mock(Directory.class);
        Tag t1 = mock(Tag.class);
        when(t1.getTagName()).thenReturn("Image Description");
        when(t1.getDescription()).thenReturn("t1");
        Tag t2 = mock(Tag.class);
        when(t2.getTagName()).thenReturn(Metadata.KEYWORDS);
        when(t2.getDescription()).thenReturn("known");
        Tag t3 = mock(Tag.class);
        when(t3.getTagName()).thenReturn(TikaCoreProperties.DESCRIPTION.getName());
        when(t3.getDescription()).thenReturn("known");
        List<Tag> tags = Arrays.asList(t1, t2, t3);
        when(d.getTags()).thenReturn(tags);
        Metadata metadata = new Metadata();
        new ImageMetadataExtractor.CopyUnknownFieldsHandler().handle(d, metadata);
        assertEquals("t1", metadata.get("Image Description"));
View Full Code Here

            while (directories.hasNext()) {
                Directory directory = (Directory) directories.next();
                Iterator<?> tags = directory.getTagIterator();

                while (tags.hasNext()) {
                    Tag tag = (Tag)tags.next();
                   
                    metadata.set(tag.getTagName(), tag.getDescription());
                }
            }
        } catch (JpegProcessingException e) {
            throw new TikaException("Can't read JPEG metadata", e);
        } catch (MetadataException e) {
View Full Code Here

          while (directories.hasNext()) {
             Directory directory = (Directory) directories.next();
             Iterator<?> tags = directory.getTagIterator();

             while (tags.hasNext()) {
                Tag tag = (Tag)tags.next();
                metadata.set(tag.getTagName(), tag.getDescription());
                handleCommonImageTags(metadata, tag, directory);
             }
             handleGeoImageTags(metadata);
          }
       } catch (MetadataException e) {
View Full Code Here

        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();
                    metadata.set(tag.getTagName(), tag.getDescription());
                }
            }
        }
View Full Code Here

        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();
                          }
View Full Code Here

            Iterator<?> it = metadata.getDirectoryIterator();
            while (it.hasNext()) {
                Directory directory = (com.drew.metadata.Directory) it.next();
                Iterator<?> tagIt = directory.getTagIterator();
                while (tagIt.hasNext()) {
                    Tag tag = (Tag) tagIt.next();
                    Object o = directory.getObject(tag.getTagType());
                    LOG.debug("Tag: " + tag + ", value: " + o + ", class: " + o.getClass() +
                            ", tag type: " + tag.getTagType() + ", hex-value: " + tag.getTagTypeHex());
                    if (null != cmisProperties) {
                        ((PropertyMapperExif)mapper).mapTagAndConvert(directory, tag, td);
                    }
                }
            }
View Full Code Here

        Iterator directories = metadata.getDirectoryIterator();
        while (directories.hasNext()) {
            Directory directory = (Directory)directories.next();
            Iterator tags = directory.getTagIterator();
            while (tags.hasNext()) {
                Tag tag = (Tag)tags.next();
                try {
                    System.out.println("[" + directory.getName() + "] " + tag.getTagName() + " = " + tag.getDescription());
                } catch (MetadataException e) {
                    System.err.println(e.getMessage());
                    System.err.println(tag.getDirectoryName() + " " + tag.getTagName() + " (error)");
                }
            }
            if (directory.hasErrors()) {
                Iterator errors = directory.getErrors();
                while (errors.hasNext()) {
View Full Code Here

TOP

Related Classes of com.drew.metadata.Tag

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.