source: josm/trunk/lib/metadata-extractor-2.3.1-nosun.diff @ 1615

Last change on this file since 1615 was 392, checked in by gebner, 12 years ago

Fix build for the IcedTea JDK.

File size: 3.9 KB
RevLine 
[392]1commit f1681c3697d5cc51c282af35557b88f65b76e8d0
2Author: Gabriel Ebner <ge@gabrielebner.at>
3Date:   Mon Oct 15 19:31:06 2007 +0200
4
5    Remove all references to the com.sun.image.codec.jpeg package.
6
7diff --git a/src/com/drew/imaging/jpeg/JpegMetadataReader.java b/src/com/drew/imaging/jpeg/JpegMetadataReader.java
8index aeacaa3..3fc08a7 100644
9--- a/src/com/drew/imaging/jpeg/JpegMetadataReader.java
10+++ b/src/com/drew/imaging/jpeg/JpegMetadataReader.java
11@@ -25,7 +25,6 @@ import com.drew.metadata.exif.ExifReader;
12 import com.drew.metadata.iptc.IptcReader;
13 import com.drew.metadata.jpeg.JpegCommentReader;
14 import com.drew.metadata.jpeg.JpegReader;
15-import com.sun.image.codec.jpeg.JPEGDecodeParam;
16 
17 import java.io.File;
18 import java.io.IOException;
19@@ -89,36 +88,6 @@ public class JpegMetadataReader
20         return metadata;
21     }
22 
23-    public static Metadata readMetadata(JPEGDecodeParam decodeParam)
24-    {
25-        final Metadata metadata = new Metadata();
26-
27-        /* We should only really be seeing Exif in _data[0]... the 2D array exists
28-         * because markers can theoretically appear multiple times in the file.
29-         */
30-        // TODO test this method
31-        byte[][] exifSegment = decodeParam.getMarkerData(JPEGDecodeParam.APP1_MARKER);
32-        if (exifSegment != null && exifSegment[0].length>0) {
33-            new ExifReader(exifSegment[0]).extract(metadata);
34-        }
35-
36-        // similarly, use only the first IPTC segment
37-        byte[][] iptcSegment = decodeParam.getMarkerData(JPEGDecodeParam.APPD_MARKER);
38-        if (iptcSegment != null && iptcSegment[0].length>0) {
39-            new IptcReader(iptcSegment[0]).extract(metadata);
40-        }
41-
42-        // NOTE: Unable to utilise JpegReader for the SOF0 frame here, as the decodeParam doesn't contain the byte[]
43-
44-        // similarly, use only the first Jpeg Comment segment
45-        byte[][] jpegCommentSegment = decodeParam.getMarkerData(JPEGDecodeParam.COMMENT_MARKER);
46-        if (jpegCommentSegment != null && jpegCommentSegment[0].length>0) {
47-            new JpegCommentReader(jpegCommentSegment[0]).extract(metadata);
48-        }
49-
50-        return metadata;
51-    }
52-
53     private JpegMetadataReader()
54     {
55     }
56diff --git a/src/com/drew/metadata/SampleUsage.java b/src/com/drew/metadata/SampleUsage.java
57index e1b1a3b..a28dafa 100644
58--- a/src/com/drew/metadata/SampleUsage.java
59+++ b/src/com/drew/metadata/SampleUsage.java
60@@ -21,9 +21,6 @@ import com.drew.imaging.jpeg.JpegProcessingException;
61 import com.drew.imaging.jpeg.JpegSegmentReader;
62 import com.drew.metadata.exif.ExifReader;
63 import com.drew.metadata.iptc.IptcReader;
64-import com.sun.image.codec.jpeg.JPEGCodec;
65-import com.sun.image.codec.jpeg.JPEGDecodeParam;
66-import com.sun.image.codec.jpeg.JPEGImageDecoder;
67 
68 import java.awt.image.BufferedImage;
69 import java.io.File;
70@@ -87,23 +84,6 @@ public class SampleUsage
71         } catch (JpegProcessingException jpe) {
72             System.err.println("error 3a");
73         }
74-       
75-        // Approach 4
76-        // This approach is the slowest, because it decodes the Jpeg image.  Of
77-        // course you now have a decoded image to play with.  In some instances
78-        // this will be most appropriate.
79-        try {
80-            JPEGImageDecoder jpegDecoder = JPEGCodec.createJPEGDecoder(new FileInputStream(jpegFile));
81-            BufferedImage image = jpegDecoder.decodeAsBufferedImage();
82-            // now you can use the image
83-            JPEGDecodeParam decodeParam = jpegDecoder.getJPEGDecodeParam();
84-            Metadata metadata = JpegMetadataReader.readMetadata(decodeParam);
85-            printImageTags(4, metadata);
86-        } catch (FileNotFoundException e) {
87-            System.err.println("error 4a");
88-        } catch (IOException e) {
89-            System.err.println("error 4b");
90-        }
91     }
92 
93     private void printImageTags(int approachCount, Metadata metadata)
Note: See TracBrowser for help on using the repository browser.