Package com.drew.metadata

Examples of com.drew.metadata.Tag


        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

                metadata.get(TikaCoreProperties.CREATED));
    }
   
    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

        }
        public void handle(Directory directory, Metadata metadata)
                throws MetadataException {
            Iterator<?> tags = directory.getTagIterator();
            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 {
            Iterator<?> tags = directory.getTagIterator();
            while (tags.hasNext()) {
                Tag tag = (Tag) tags.next();
                String name = tag.getTagName();
                if (!MetadataFields.isMetadataField(name)) {
                   try {
                      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

        }
        public void handle(Directory directory, Metadata metadata)
                throws MetadataException {
            Iterator<?> tags = directory.getTagIterator();
            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 {
            Iterator<?> tags = directory.getTagIterator();
            while (tags.hasNext()) {
                Tag tag = (Tag) tags.next();
                String name = tag.getTagName();
                if (!MetadataFields.isMetadataField(name)) {
                    metadata.set(name, tag.getDescription());
                }
            }
        }
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

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.