Examples of JpegSegmentReader


Examples of com.drew.imaging.jpeg.JpegSegmentReader

    public void testReadJpegByteArray() throws Exception
    {
        File jpeg = new File("Source/com/drew/metadata/exif/test/withExif.jpg");
        byte[] fileContents = new byte[(int)jpeg.length()];
        new FileInputStream(jpeg).read(fileContents);
        new JpegSegmentReader(fileContents).readSegment(JpegSegmentReader.SEGMENT_APP1);
    }
View Full Code Here

Examples of com.drew.imaging.jpeg.JpegSegmentReader

    public void testCreateWithInputStream() throws Exception
    {
        File jpeg = new File("Source/com/drew/metadata/exif/test/withExif.jpg");
        InputStream in = new FileInputStream(jpeg);
        JpegSegmentReader reader = null;
        try {
            reader = new JpegSegmentReader(in);
        } catch (JpegProcessingException e) {
            fail("Error constructing JpegSegmentReader using InputStream");
        }
        // this will never happen, as fail() is guaranteed to throw an AssertionException
        if (reader==null)
            return;
        byte[] exifData = reader.readSegment(JpegSegmentReader.SEGMENT_APP1);
        assertEquals("Exif", new String(exifData, 0, 4));
    }
View Full Code Here

Examples of com.drew.imaging.jpeg.JpegSegmentReader

    }

    public void testReadSecondSegmentInstanace() throws Exception
    {
        File jpeg = new File("Source/com/drew/imaging/jpeg/test/withExifAndIptc.jpg");
        JpegSegmentReader reader = new JpegSegmentReader(jpeg);
        byte[] exifData0 = reader.readSegment(JpegSegmentReader.SEGMENT_APP1, 0);
        byte[] exifData1 = reader.readSegment(JpegSegmentReader.SEGMENT_APP1, 1);
        assertEquals("Exif", new String(exifData0, 0, 4));
        assertEquals("http", new String(exifData1, 0, 4));
    }
View Full Code Here

Examples of com.drew.imaging.jpeg.JpegSegmentReader

    }

    public void testReadNonExistantSegmentInstance() throws Exception
    {
        File jpeg = new File("Source/com/drew/imaging/jpeg/test/withExifAndIptc.jpg");
        JpegSegmentReader reader = new JpegSegmentReader(jpeg);
        assertNull("third exif segment shouldn't exist", reader.readSegment(JpegSegmentReader.SEGMENT_APP1, 3));
    }
View Full Code Here

Examples of com.drew.imaging.jpeg.JpegSegmentReader

    }

    public void testGetSegmentCount() throws Exception
    {
        File jpeg = new File("Source/com/drew/imaging/jpeg/test/withExifAndIptc.jpg");
        JpegSegmentReader reader = new JpegSegmentReader(jpeg);
        assertEquals(2, reader.getSegmentCount(JpegSegmentReader.SEGMENT_APP1));
        assertEquals(1, reader.getSegmentCount(JpegSegmentReader.SEGMENT_APP2));
        assertEquals(0, reader.getSegmentCount(JpegSegmentReader.SEGMENT_APP3));
    }
View Full Code Here

Examples of com.drew.imaging.jpeg.JpegSegmentReader

    }

    public void testCreateWithFileAndReadMultipleSegments() throws Exception
    {
        File jpeg = new File("Source/com/drew/imaging/jpeg/test/withExifAndIptc.jpg");
        JpegSegmentReader reader = new JpegSegmentReader(jpeg);
        validateMultipleSegmentRead(reader);
    }
View Full Code Here

Examples of com.drew.imaging.jpeg.JpegSegmentReader

    public void testCreateWithInputStreamAndReadMultipleSegments() throws Exception
    {
        File jpeg = new File("Source/com/drew/imaging/jpeg/test/withExifAndIptc.jpg");
        InputStream in = new FileInputStream(jpeg);
        JpegSegmentReader reader = new JpegSegmentReader(in);
        validateMultipleSegmentRead(reader);
    }
View Full Code Here

Examples of com.drew.imaging.jpeg.JpegSegmentReader

    /**
     * Creates a new JpegReader for the specified Jpeg jpegFile.
     */
    public JpegReader(File jpegFile) throws JpegProcessingException
    {
        this(new JpegSegmentReader(jpegFile).readSegment(JpegSegmentReader.SEGMENT_SOF0));
    }
View Full Code Here

Examples of com.drew.imaging.jpeg.JpegSegmentReader

     * Creates a JpegReader for a JPEG stream.
     * @param is JPEG stream. Stream will be closed.
     */
    public JpegReader(InputStream is) throws JpegProcessingException
    {
        this(new JpegSegmentReader(is).readSegment(JpegSegmentReader.SEGMENT_APPD));
    }
View Full Code Here

Examples of com.drew.imaging.jpeg.JpegSegmentReader

    /**
     * Creates a new JpegReader for the specified Jpeg jpegFile.
     */
    public JpegCommentReader(File jpegFile) throws JpegProcessingException
    {
        this(new JpegSegmentReader(jpegFile).readSegment(JpegSegmentReader.SEGMENT_COM));
    }
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.