diff options
author | Harvey Harrison <[email protected]> | 2012-08-27 23:45:48 -0700 |
---|---|---|
committer | Harvey Harrison <[email protected]> | 2012-08-27 23:45:48 -0700 |
commit | 4a72fa57b7acfba8b553d5dc34a903d72e56410a (patch) | |
tree | 8bc3a854f4689277b8cf3fd750d637c005272d97 | |
parent | 90980983599d34e7058fa1231ba1917b7475ef94 (diff) |
j3dutils: remove use of deprecated JPEGEncoder/Decoder, use ImageIO
As this is only used in the serialization functions just rely on the defaults
throughout. I tried round-tripping the resulting bytestream and it worked just
fine.
Signed-off-by: Harvey Harrison <[email protected]>
-rw-r--r-- | src/classes/share/com/sun/j3d/utils/scenegraph/io/state/javax/media/j3d/ImageComponentState.java | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/classes/share/com/sun/j3d/utils/scenegraph/io/state/javax/media/j3d/ImageComponentState.java b/src/classes/share/com/sun/j3d/utils/scenegraph/io/state/javax/media/j3d/ImageComponentState.java index 0a847a6..e54c95e 100644 --- a/src/classes/share/com/sun/j3d/utils/scenegraph/io/state/javax/media/j3d/ImageComponentState.java +++ b/src/classes/share/com/sun/j3d/utils/scenegraph/io/state/javax/media/j3d/ImageComponentState.java @@ -60,11 +60,9 @@ import java.io.IOException; import java.util.zip.GZIPInputStream; import java.util.zip.GZIPOutputStream; +import javax.imageio.ImageIO; import javax.media.j3d.ImageComponent; -import com.sun.image.codec.jpeg.JPEGCodec; -import com.sun.image.codec.jpeg.JPEGImageDecoder; -import com.sun.image.codec.jpeg.JPEGImageEncoder; import com.sun.j3d.utils.scenegraph.io.retained.Controller; import com.sun.j3d.utils.scenegraph.io.retained.SGIORuntimeException; import com.sun.j3d.utils.scenegraph.io.retained.SymbolTableData; @@ -206,9 +204,7 @@ public abstract class ImageComponentState extends NodeComponentState { private void writeBufferedImageJpegCompression( DataOutput out, BufferedImage image ) throws IOException { ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); - JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder( byteStream ); - - encoder.encode( image ); + ImageIO.write(image, "jpeg", byteStream); byteStream.close(); byte[] buffer = byteStream.toByteArray(); @@ -265,10 +261,7 @@ public abstract class ImageComponentState extends NodeComponentState { in.readFully( buffer ); ByteArrayInputStream byteStream = new ByteArrayInputStream( buffer ); - JPEGImageDecoder decoder = JPEGCodec.createJPEGDecoder( byteStream ); - byteStream.close(); - - return decoder.decodeAsBufferedImage(); + return ImageIO.read(byteStream); } private void writeColorModel( DataOutput out, ColorModel colorModel ) throws IOException { |