commit f1681c3697d5cc51c282af35557b88f65b76e8d0 Author: Gabriel Ebner Date: Mon Oct 15 19:31:06 2007 +0200 Remove all references to the com.sun.image.codec.jpeg package. diff --git a/src/com/drew/imaging/jpeg/JpegMetadataReader.java b/src/com/drew/imaging/jpeg/JpegMetadataReader.java index aeacaa3..3fc08a7 100644 --- a/src/com/drew/imaging/jpeg/JpegMetadataReader.java +++ b/src/com/drew/imaging/jpeg/JpegMetadataReader.java @@ -25,7 +25,6 @@ import com.drew.metadata.exif.ExifReader; import com.drew.metadata.iptc.IptcReader; import com.drew.metadata.jpeg.JpegCommentReader; import com.drew.metadata.jpeg.JpegReader; -import com.sun.image.codec.jpeg.JPEGDecodeParam; import java.io.File; import java.io.IOException; @@ -89,36 +88,6 @@ public class JpegMetadataReader return metadata; } - public static Metadata readMetadata(JPEGDecodeParam decodeParam) - { - final Metadata metadata = new Metadata(); - - /* We should only really be seeing Exif in _data[0]... the 2D array exists - * because markers can theoretically appear multiple times in the file. - */ - // TODO test this method - byte[][] exifSegment = decodeParam.getMarkerData(JPEGDecodeParam.APP1_MARKER); - if (exifSegment != null && exifSegment[0].length>0) { - new ExifReader(exifSegment[0]).extract(metadata); - } - - // similarly, use only the first IPTC segment - byte[][] iptcSegment = decodeParam.getMarkerData(JPEGDecodeParam.APPD_MARKER); - if (iptcSegment != null && iptcSegment[0].length>0) { - new IptcReader(iptcSegment[0]).extract(metadata); - } - - // NOTE: Unable to utilise JpegReader for the SOF0 frame here, as the decodeParam doesn't contain the byte[] - - // similarly, use only the first Jpeg Comment segment - byte[][] jpegCommentSegment = decodeParam.getMarkerData(JPEGDecodeParam.COMMENT_MARKER); - if (jpegCommentSegment != null && jpegCommentSegment[0].length>0) { - new JpegCommentReader(jpegCommentSegment[0]).extract(metadata); - } - - return metadata; - } - private JpegMetadataReader() { } diff --git a/src/com/drew/metadata/SampleUsage.java b/src/com/drew/metadata/SampleUsage.java index e1b1a3b..a28dafa 100644 --- a/src/com/drew/metadata/SampleUsage.java +++ b/src/com/drew/metadata/SampleUsage.java @@ -21,9 +21,6 @@ import com.drew.imaging.jpeg.JpegProcessingException; import com.drew.imaging.jpeg.JpegSegmentReader; import com.drew.metadata.exif.ExifReader; import com.drew.metadata.iptc.IptcReader; -import com.sun.image.codec.jpeg.JPEGCodec; -import com.sun.image.codec.jpeg.JPEGDecodeParam; -import com.sun.image.codec.jpeg.JPEGImageDecoder; import java.awt.image.BufferedImage; import java.io.File; @@ -87,23 +84,6 @@ public class SampleUsage } catch (JpegProcessingException jpe) { System.err.println("error 3a"); } - - // Approach 4 - // This approach is the slowest, because it decodes the Jpeg image. Of - // course you now have a decoded image to play with. In some instances - // this will be most appropriate. - try { - JPEGImageDecoder jpegDecoder = JPEGCodec.createJPEGDecoder(new FileInputStream(jpegFile)); - BufferedImage image = jpegDecoder.decodeAsBufferedImage(); - // now you can use the image - JPEGDecodeParam decodeParam = jpegDecoder.getJPEGDecodeParam(); - Metadata metadata = JpegMetadataReader.readMetadata(decodeParam); - printImageTags(4, metadata); - } catch (FileNotFoundException e) { - System.err.println("error 4a"); - } catch (IOException e) { - System.err.println("error 4b"); - } } private void printImageTags(int approachCount, Metadata metadata)