Package com.drew.metadata

Examples of com.drew.metadata.MetadataReader.extract()


    public void testDescription_City() throws Exception
    {
        File iptcFile = new File("src/com/drew/metadata/iptc/test/withIptc.jpg");
        MetadataReader reader = new IptcReader(iptcFile);
        Metadata metadata = reader.extract();
        assertTrue(metadata.containsDirectory(IptcDirectory.class));
        Directory directory = metadata.getDirectory(IptcDirectory.class);
        assertEquals("City", directory.getDescription(IptcDirectory.TAG_CITY));
    }
View Full Code Here


    public void testDescription_Caption() throws Exception
    {
        File iptcFile = new File("src/com/drew/metadata/iptc/test/withIptc.jpg");
        MetadataReader reader = new IptcReader(iptcFile);
        Metadata metadata = reader.extract();
        assertTrue(metadata.containsDirectory(IptcDirectory.class));
        Directory directory = metadata.getDirectory(IptcDirectory.class);
        assertEquals("Caption", directory.getDescription(IptcDirectory.TAG_CAPTION));
    }
View Full Code Here

    public void testDescription_Category() throws Exception
    {
        File iptcFile = new File("src/com/drew/metadata/iptc/test/withIptc.jpg");
        MetadataReader reader = new IptcReader(iptcFile);
        Metadata metadata = reader.extract();
        assertTrue(metadata.containsDirectory(IptcDirectory.class));
        Directory directory = metadata.getDirectory(IptcDirectory.class);
        assertEquals("Supl. Category2 Supl. Category1 Cat", directory.getDescription(IptcDirectory.TAG_CATEGORY));
    }
View Full Code Here

    {
        final byte[] jfifData = new byte[] { 74,70,73,70,0, 1,2, 1, 0,108, 0,108, 0,0 };

        final Metadata metadata = new Metadata();
        final MetadataReader reader = new JfifReader();
        reader.extract(new ByteArrayReader(jfifData), metadata);

        Assert.assertEquals(1, metadata.getDirectoryCount());
        JfifDirectory directory = metadata.getDirectory(JfifDirectory.class);
        Assert.assertNotNull(directory);
        Assert.assertFalse(directory.getErrors().toString(), directory.hasErrors());
View Full Code Here

        File jpegFile = new File("Tests/com/drew/metadata/jpeg/simple.jpg");
        final byte[] data = new JpegSegmentReader(jpegFile).readSegment(JpegSegmentReader.SEGMENT_SOF0);
        MetadataReader reader = new JpegReader();
        Metadata metadata = new Metadata();
        Assert.assertNotNull(data);
        reader.extract(new ByteArrayReader(data), metadata);
        Assert.assertTrue(metadata.containsDirectory(JpegDirectory.class));
        _directory = metadata.getOrCreateDirectory(JpegDirectory.class);
    }

    @Test
View Full Code Here

    {
        final byte[] bytes = TestHelper.loadFileBytes(new File("Tests/com/drew/metadata/iptc/iptc1.bytes"));

        Metadata metadata = new Metadata();
        MetadataReader reader = new IptcReader();
        reader.extract(new ByteArrayReader(bytes), metadata);

        Assert.assertEquals(1, metadata.getDirectoryCount());
        IptcDirectory directory = metadata.getDirectory(IptcDirectory.class);
        Assert.assertNotNull(directory);
        Assert.assertFalse(directory.getErrors().toString(), directory.hasErrors());
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.