Examples of containsTag()


Examples of com.drew.metadata.Directory.containsTag()

    public void testContainsTag() throws Exception
    {
        Metadata metadata = new Metadata();
        Directory exifDir = metadata.getDirectory(ExifDirectory.class);
        assertTrue(!exifDir.containsTag(ExifDirectory.TAG_APERTURE));
        exifDir.setString(ExifDirectory.TAG_APERTURE, "Tag Value");
        assertTrue(exifDir.containsTag(ExifDirectory.TAG_APERTURE));
    }

    public void testGetNonExistantTag() throws Exception
View Full Code Here

Examples of com.drew.metadata.Directory.containsTag()

    {
        Metadata metadata = new Metadata();
        Directory exifDir = metadata.getDirectory(ExifDirectory.class);
        assertTrue(!exifDir.containsTag(ExifDirectory.TAG_APERTURE));
        exifDir.setString(ExifDirectory.TAG_APERTURE, "Tag Value");
        assertTrue(exifDir.containsTag(ExifDirectory.TAG_APERTURE));
    }

    public void testGetNonExistantTag() throws Exception
    {
        Metadata metadata = new Metadata();
View Full Code Here

Examples of com.drew.metadata.exif.ExifDirectory.containsTag()

    public void testGetThumbnailData() throws Exception
    {
        File file = new File("src/com/drew/metadata/exif/test/withExif.jpg");
        Metadata metadata = JpegMetadataReader.readMetadata(file);
        ExifDirectory exifDirectory = (ExifDirectory)metadata.getDirectory(ExifDirectory.class);
        assertTrue(exifDirectory.containsTag(ExifDirectory.TAG_THUMBNAIL_DATA));
        byte[] thumbData = exifDirectory.getThumbnailData();
        try {
            // attempt to read the thumbnail -- it should be a legal Jpeg file
            new JpegSegmentReader(thumbData);
        } catch (JpegProcessingException e) {
View Full Code Here

Examples of com.drew.metadata.exif.ExifDirectory.containsTag()

    public void testWriteThumbnail() throws Exception
    {
        File file = new File("src/com/drew/metadata/exif/test/manuallyAddedThumbnail.jpg");
        Metadata metadata = JpegMetadataReader.readMetadata(file);
        ExifDirectory exifDirectory = (ExifDirectory)metadata.getDirectory(ExifDirectory.class);
        assertTrue(exifDirectory.containsTag(ExifDirectory.TAG_THUMBNAIL_DATA));

        File thumbnailFile = File.createTempFile("thumbnail", ".jpg");
        try {
            exifDirectory.writeThumbnail(thumbnailFile.getAbsolutePath());
            assertTrue(new File(thumbnailFile.getAbsolutePath()).exists());
View Full Code Here

Examples of com.drew.metadata.exif.ExifDirectory.containsTag()

        assertFalse(new ImageMetadataExtractor.ExifHandler().supports(JpegCommentDirectory.class));
    }
   
    public void testExifHandlerParseDate() throws MetadataException {
        ExifDirectory exif = mock(ExifDirectory.class);
        when(exif.containsTag(ExifDirectory.TAG_DATETIME_ORIGINAL)).thenReturn(true);
        when(exif.getDate(ExifDirectory.TAG_DATETIME_ORIGINAL)).thenReturn(
                new GregorianCalendar(2000, 0, 1, 0, 0, 0).getTime()); // jvm default timezone as in Metadata Extractor
        Metadata metadata = new Metadata();
       
        new ImageMetadataExtractor.ExifHandler().handle(exif, metadata);
View Full Code Here

Examples of com.drew.metadata.exif.ExifDirectory.containsTag()

                metadata.get(TikaCoreProperties.CREATED));
    }

    public void testExifHandlerParseDateFallback() throws MetadataException {
        ExifDirectory exif = mock(ExifDirectory.class);
        when(exif.containsTag(ExifDirectory.TAG_DATETIME)).thenReturn(true);
        when(exif.getDate(ExifDirectory.TAG_DATETIME)).thenReturn(
                new GregorianCalendar(1999, 0, 1, 0, 0, 0).getTime()); // jvm default timezone as in Metadata Extractor
        Metadata metadata = new Metadata();
       
        new ImageMetadataExtractor.ExifHandler().handle(exif, metadata);
View Full Code Here

Examples of com.drew.metadata.exif.ExifDirectory.containsTag()

                metadata.get(TikaCoreProperties.CREATED));
    }
   
    public void testExifHandlerParseDateError() throws MetadataException {
        ExifDirectory exif = mock(ExifDirectory.class);
        when(exif.containsTag(ExifDirectory.TAG_DATETIME_ORIGINAL)).thenReturn(true);
        when(exif.getDate(ExifDirectory.TAG_DATETIME_ORIGINAL)).thenThrow(
                new MetadataException("Tag 'X' cannot be cast to a java.util.Date."));
        Metadata metadata = new Metadata();
       
        new ImageMetadataExtractor.ExifHandler().handle(exif, metadata);
View Full Code Here

Examples of com.drew.metadata.exif.ExifIFD0Directory.containsTag()

    }

    @Test
    public void testExifHandlerParseDateFallback() throws MetadataException {
        ExifIFD0Directory exif = mock(ExifIFD0Directory.class);
        when(exif.containsTag(ExifIFD0Directory.TAG_DATETIME)).thenReturn(true);
        when(exif.getDate(ExifIFD0Directory.TAG_DATETIME)).thenReturn(
                new GregorianCalendar(1999, 0, 1, 0, 0, 0).getTime()); // jvm default timezone as in Metadata Extractor
        Metadata metadata = new Metadata();
       
        new ImageMetadataExtractor.ExifHandler().handle(exif, metadata);
View Full Code Here

Examples of com.drew.metadata.exif.ExifIFD0Directory.containsTag()

    }
   
    @Test
    public void testExifHandlerParseDateError() throws MetadataException {
        ExifIFD0Directory exif = mock(ExifIFD0Directory.class);
        when(exif.containsTag(ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL)).thenReturn(true);
        when(exif.getDate(ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL)).thenReturn(null);
        Metadata metadata = new Metadata();
       
        new ImageMetadataExtractor.ExifHandler().handle(exif, metadata);
        assertEquals("Parsing should proceed without date", null,
View Full Code Here

Examples of com.drew.metadata.exif.ExifSubIFDDirectory.containsTag()

    }
   
    @Test
    public void testExifHandlerParseDate() throws MetadataException {
        ExifSubIFDDirectory exif = mock(ExifSubIFDDirectory.class);
        when(exif.containsTag(ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL)).thenReturn(true);
        when(exif.getDate(ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL)).thenReturn(
                new GregorianCalendar(2000, 0, 1, 0, 0, 0).getTime()); // jvm default timezone as in Metadata Extractor
        Metadata metadata = new Metadata();
       
        new ImageMetadataExtractor.ExifHandler().handle(exif, metadata);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.