harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r463126 - in /incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java: javax/imageio/ javax/imageio/plugins/jpeg/ javax/imageio/spi/ javax/imageio/stream/ org/apache/harmony/x/imageio/plugins/jpeg/ org/apache/harmony/x/image...
Date Thu, 12 Oct 2006 03:41:05 GMT
Author: ndbeyer
Date: Wed Oct 11 20:41:03 2006
New Revision: 463126

URL: http://svn.apache.org/viewvc?view=rev&rev=463126
Log:
* Generify APIs to match spec
* Add annotations to remove compiler warnings
* Correct the invalid synchronization in IIORegistry

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/IIOImage.java
    incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/ImageIO.java
    incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/ImageReadParam.java
    incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/ImageReader.java
    incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/ImageTypeSpecifier.java
    incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/ImageWriter.java
    incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/plugins/jpeg/JPEGQTable.java
    incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/spi/IIORegistry.java
    incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/spi/IIOServiceProvider.java
    incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/spi/ImageInputStreamSpi.java
    incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/spi/ImageOutputStreamSpi.java
    incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/spi/ImageReaderWriterSpi.java
    incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/spi/RegisterableService.java
    incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/spi/ServiceRegistry.java
    incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/stream/FileImageOutputStream.java
    incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/stream/ImageInputStreamImpl.java
    incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/plugins/jpeg/IISDecodingImageSource.java
    incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/plugins/jpeg/JPEGImageReader.java
    incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/plugins/jpeg/JPEGImageReaderSpi.java
    incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/plugins/jpeg/JPEGImageWriter.java
    incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/plugins/jpeg/JPEGImageWriterSpi.java
    incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/spi/FileIISSpi.java
    incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/spi/FileIOSSpi.java
    incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/spi/RAFIISSpi.java
    incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/spi/RAFIOSSpi.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/IIOImage.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/IIOImage.java?view=diff&rev=463126&r1=463125&r2=463126
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/IIOImage.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/IIOImage.java Wed Oct 11 20:41:03 2006
@@ -30,11 +30,10 @@
 
     protected RenderedImage image;
     protected Raster raster;
-    protected List thumbnails;
+    protected List<? extends BufferedImage> thumbnails;
     protected IIOMetadata metadata;
 
-
-    public IIOImage(RenderedImage image, List thumbnails, IIOMetadata metadata) {
+    public IIOImage(RenderedImage image, List<? extends BufferedImage> thumbnails, IIOMetadata metadata) {
         if (image == null) {
             throw new IllegalArgumentException("image should not be NULL");
         }
@@ -44,7 +43,7 @@
         this.metadata = metadata;
     }
 
-    public IIOImage(Raster raster, List thumbnails, IIOMetadata metadata) {
+    public IIOImage(Raster raster, List<? extends BufferedImage> thumbnails, IIOMetadata metadata) {
         if (raster == null) {
             throw new IllegalArgumentException("raster should not be NULL");
         }
@@ -88,16 +87,16 @@
 
     public BufferedImage getThumbnail(int index) {
         if (thumbnails != null) {
-            return (BufferedImage) thumbnails.get(index);
+            return thumbnails.get(index);
         }
         throw new IndexOutOfBoundsException("no thumbnails were set");
     }
 
-    public List getThumbnails() {
+    public List<? extends BufferedImage> getThumbnails() {
         return thumbnails;
     }
 
-    public void setThumbnails(List thumbnails) {
+    public void setThumbnails(List<? extends BufferedImage> thumbnails) {
         this.thumbnails = thumbnails;
     }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/ImageIO.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/ImageIO.java?view=diff&rev=463126&r1=463125&r2=463126
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/ImageIO.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/ImageIO.java Wed Oct 11 20:41:03 2006
@@ -70,10 +70,10 @@
             throw new IllegalArgumentException("input source cannot be NULL");
         }
 
-        Iterator it = registry.getServiceProviders(ImageInputStreamSpi.class, true);
+        Iterator<ImageInputStreamSpi> it = registry.getServiceProviders(ImageInputStreamSpi.class, true);
 
         while (it.hasNext()) {
-            ImageInputStreamSpi spi = (ImageInputStreamSpi) it.next();
+            ImageInputStreamSpi spi = it.next();
             if (spi.getInputClass().isInstance(input)) {
                 return spi.createInputStreamInstance(input);
             }
@@ -87,10 +87,10 @@
             throw new IllegalArgumentException("output destination cannot be NULL");
         }
 
-        Iterator it = registry.getServiceProviders(ImageOutputStreamSpi.class, true);
+        Iterator<ImageOutputStreamSpi> it = registry.getServiceProviders(ImageOutputStreamSpi.class, true);
 
         while (it.hasNext()) {
-            ImageOutputStreamSpi spi = (ImageOutputStreamSpi) it.next();
+            ImageOutputStreamSpi spi = it.next();
             if (spi.getOutputClass().isInstance(output)) {
                 return spi.createOutputStreamInstance(output);
             }
@@ -106,39 +106,39 @@
         throw new UnsupportedOperationException("Not supported yet");
     }
 
-    public static Iterator getImageReaders(Object input) {
+    public static Iterator<ImageReader> getImageReaders(Object input) {
         if (input == null) {
             throw new NullPointerException("input cannot be NULL");
         }
 
-        Iterator it = registry.getServiceProviders(ImageReaderSpi.class,
+        Iterator<ImageReaderSpi> it = registry.getServiceProviders(ImageReaderSpi.class,
                 new CanReadFilter(input), true);
 
         return new SpiIteratorToReadersIteratorWrapper(it);
     }
 
-    public static Iterator getImageReadersByFormatName(String formatName) {
+    public static Iterator<ImageReader> getImageReadersByFormatName(String formatName) {
         if (formatName == null) {
             throw new NullPointerException("format name cannot be NULL");
         }
 
-        Iterator it = registry.getServiceProviders(ImageReaderSpi.class,
+        Iterator<ImageReaderSpi> it = registry.getServiceProviders(ImageReaderSpi.class,
                 new FormatFilter(formatName), true);
 
         return new SpiIteratorToReadersIteratorWrapper(it);
     }
 
-    public static Iterator getImageReadersBySuffix(String fileSuffix) {
+    public static Iterator<ImageReader> getImageReadersBySuffix(String fileSuffix) {
         if (fileSuffix == null) {
             throw new NullPointerException("suffix cannot be NULL");
         }
-        Iterator it = registry.getServiceProviders(ImageReaderSpi.class,
+        Iterator<ImageReaderSpi> it = registry.getServiceProviders(ImageReaderSpi.class,
                 new SuffixFilter(fileSuffix), true);
 
         return new SpiIteratorToReadersIteratorWrapper(it);
     }
 
-    public static Iterator getImageReadersByMIMEType(String MIMEType) {
+    public static Iterator<ImageReader> getImageReadersByMIMEType(String MIMEType) {
         throw new UnsupportedOperationException("Not supported yet");
     }
 
@@ -150,27 +150,27 @@
         throw new UnsupportedOperationException("Not supported yet");
     }
 
-    public static Iterator getImageWritersByFormatName(String formatName) {
+    public static Iterator<ImageWriter> getImageWritersByFormatName(String formatName) {
         if (formatName == null) {
             throw new NullPointerException("format name cannot be NULL");
         }
 
-        Iterator it = registry.getServiceProviders(ImageWriterSpi.class,
+        Iterator<ImageWriterSpi> it = registry.getServiceProviders(ImageWriterSpi.class,
                 new FormatFilter(formatName), true);
 
         return new SpiIteratorToWritersIteratorWrapper(it);
     }
 
-    public static Iterator getImageWritersBySuffix(String fileSuffix) {
+    public static Iterator<ImageWriter> getImageWritersBySuffix(String fileSuffix) {
         if (fileSuffix == null) {
             throw new NullPointerException("suffix cannot be NULL");
         }
-        Iterator it = registry.getServiceProviders(ImageWriterSpi.class,
+        Iterator<ImageWriterSpi> it = registry.getServiceProviders(ImageWriterSpi.class,
                 new SuffixFilter(fileSuffix), true);
         return new SpiIteratorToWritersIteratorWrapper(it);
     }
 
-    public static Iterator getImageWritersByMIMEType(String MIMEType) {
+    public static Iterator<ImageWriter> getImageWritersByMIMEType(String MIMEType) {
         throw new UnsupportedOperationException("Not supported yet");
     }
 
@@ -182,7 +182,7 @@
         throw new UnsupportedOperationException("Not supported yet");
     }
 
-    public static Iterator getImageWriters(ImageTypeSpecifier type,
+    public static Iterator<ImageWriter> getImageWriters(ImageTypeSpecifier type,
                                            String formatName) {
         if (type == null) {
             throw new NullPointerException("type cannot be NULL");
@@ -192,13 +192,13 @@
             throw new NullPointerException("format name cannot be NULL");
         }
 
-        Iterator it = registry.getServiceProviders(ImageWriterSpi.class,
+        Iterator<ImageWriterSpi> it = registry.getServiceProviders(ImageWriterSpi.class,
                 new FormatAndEncodeFilter(type, formatName), true);
 
         return new SpiIteratorToWritersIteratorWrapper(it);
     }
 
-    public static Iterator getImageTranscoders(ImageReader reader,
+    public static Iterator<ImageTranscoder> getImageTranscoders(ImageReader reader,
                                                ImageWriter writer) {
         throw new UnsupportedOperationException("Not supported yet");
     }
@@ -238,9 +238,9 @@
             throw new IllegalArgumentException("output cannot be NULL");
         }
 
-        Iterator it = getImageWriters(ImageTypeSpecifier.createFromRenderedImage(im), formatName);
+        Iterator<ImageWriter> it = getImageWriters(ImageTypeSpecifier.createFromRenderedImage(im), formatName);
         if (it.hasNext()) {
-            ImageWriter writer = (ImageWriter) it.next();
+            ImageWriter writer = it.next();
             writer.setOutput(output);
             writer.write(im);
             output.flush();
@@ -313,6 +313,7 @@
             this.type = type;
         }
 
+        @Override
         public boolean filter(Object provider) {
             ImageWriterSpi spi = (ImageWriterSpi) provider;
             return super.filter(provider) && spi.canEncodeImage(type);
@@ -358,17 +359,17 @@
     /**
      * Wraps Spi's iterator to ImageWriter iterator
      */
-    static class SpiIteratorToWritersIteratorWrapper implements Iterator {
+    static class SpiIteratorToWritersIteratorWrapper implements Iterator<ImageWriter> {
 
-        private Iterator backend;
+        private Iterator<ImageWriterSpi> backend;
 
-        public SpiIteratorToWritersIteratorWrapper(Iterator backend) {
+        public SpiIteratorToWritersIteratorWrapper(Iterator<ImageWriterSpi> backend) {
             this.backend = backend;
         }
 
-        public Object next() {
+        public ImageWriter next() {
             try {
-                return ((ImageWriterSpi) backend.next()).createWriterInstance();
+                return backend.next().createWriterInstance();
             } catch (IOException e) {
                 e.printStackTrace();
                 return null;
@@ -387,16 +388,16 @@
     /**
      * Wraps spi's iterator to ImageReader iterator
      */
-    static class SpiIteratorToReadersIteratorWrapper implements Iterator {
-        private Iterator backend;
+    static class SpiIteratorToReadersIteratorWrapper implements Iterator<ImageReader> {
+        private Iterator<ImageReaderSpi> backend;
 
-        public SpiIteratorToReadersIteratorWrapper(Iterator backend) {
+        public SpiIteratorToReadersIteratorWrapper(Iterator<ImageReaderSpi> backend) {
             this.backend = backend;
         }
 
-        public Object next() {
+        public ImageReader next() {
             try {
-                return ((ImageReaderSpi) backend.next()).createReaderInstance();
+                return backend.next().createReaderInstance();
             } catch (IOException e) {
                 e.printStackTrace();
                 return null;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/ImageReadParam.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/ImageReadParam.java?view=diff&rev=463126&r1=463125&r2=463126
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/ImageReadParam.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/ImageReadParam.java Wed Oct 11 20:41:03 2006
@@ -75,6 +75,7 @@
         this.destinationBands = destinationBands;
     }
 
+    @Override
     public void setDestinationType(ImageTypeSpecifier destinationType) {
         this.destinationType = destinationType;
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/ImageReader.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/ImageReader.java?view=diff&rev=463126&r1=463125&r2=463126
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/ImageReader.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/ImageReader.java Wed Oct 11 20:41:03 2006
@@ -52,13 +52,13 @@
 
     protected Locale locale;
 
-    protected List warningListeners;
+    protected List<IIOReadWarningListener> warningListeners;
 
-    protected List warningLocales;
+    protected List<Locale> warningLocales;
 
-    protected List progressListeners;
+    protected List<IIOReadProgressListener> progressListeners;
 
-    protected List updateListeners;
+    protected List<IIOReadUpdateListener> updateListeners;
 
     protected ImageReader(ImageReaderSpi originatingProvider) {
         this.originatingProvider = originatingProvider;
@@ -88,8 +88,8 @@
         ImageReaderSpi spi = getOriginatingProvider();
         if (null != spi) {
             Class[] outTypes = spi.getInputTypes();
-            for(int i = 0; i < outTypes.length; i++) {
-                if (outTypes[i].isInstance(input)) {
+            for (Class<?> element : outTypes) {
+                if (element.isInstance(input)) {
                     return true;
                 }
             }
@@ -151,7 +151,7 @@
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
-    public abstract Iterator getImageTypes(int imageIndex) throws IOException;
+    public abstract Iterator<ImageTypeSpecifier> getImageTypes(int imageIndex) throws IOException;
 
     public ImageReadParam getDefaultReadParam() {
         throw new UnsupportedOperationException("Not implemented yet");
@@ -159,7 +159,7 @@
 
     public abstract IIOMetadata getStreamMetadata() throws IOException;
 
-    public IIOMetadata getStreamMetadata(String formatName, Set nodeNames)
+    public IIOMetadata getStreamMetadata(String formatName, Set<String> nodeNames)
             throws IOException {
         throw new UnsupportedOperationException("Not implemented yet");
     }
@@ -167,7 +167,7 @@
     public abstract IIOMetadata getImageMetadata(int imageIndex) throws IOException;
 
     public IIOMetadata getImageMetadata(int imageIndex, String formatName,
-                                        Set nodeNames) throws IOException {
+                                        Set<String> nodeNames) throws IOException {
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
@@ -181,7 +181,7 @@
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
-    public Iterator readAll(Iterator params) throws IOException {
+    public Iterator<IIOImage> readAll(Iterator<? extends ImageReadParam> params) throws IOException {
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
@@ -428,7 +428,7 @@
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
-    protected static BufferedImage getDestination(ImageReadParam param, Iterator imageTypes,
+    protected static BufferedImage getDestination(ImageReadParam param, Iterator<ImageTypeSpecifier> imageTypes,
                                               int width,
                                               int height)
                                        throws IIOException {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/ImageTypeSpecifier.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/ImageTypeSpecifier.java?view=diff&rev=463126&r1=463125&r2=463126
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/ImageTypeSpecifier.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/ImageTypeSpecifier.java Wed Oct 11 20:41:03 2006
@@ -156,6 +156,7 @@
         throw new UnsupportedOperationException("Not supported yet");
     }
 
+    @Override
     public boolean equals(Object o) {
         boolean rt = false;
         if (o instanceof ImageTypeSpecifier) {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/ImageWriter.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/ImageWriter.java?view=diff&rev=463126&r1=463125&r2=463126
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/ImageWriter.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/ImageWriter.java Wed Oct 11 20:41:03 2006
@@ -20,15 +20,14 @@
  */
 package javax.imageio;
 
-import javax.imageio.metadata.IIOMetadata;
-import javax.imageio.spi.ImageWriterSpi;
-import javax.imageio.event.IIOWriteProgressListener;
-import javax.imageio.event.IIOWriteWarningListener;
-import java.io.IOException;
 import java.awt.image.RenderedImage;
-import java.util.Locale;
+import java.io.IOException;
 import java.util.List;
-import java.util.Iterator;
+import java.util.Locale;
+import javax.imageio.event.IIOWriteProgressListener;
+import javax.imageio.event.IIOWriteWarningListener;
+import javax.imageio.metadata.IIOMetadata;
+import javax.imageio.spi.ImageWriterSpi;
 
 /**
  * TODO: Implement the rest of methods
@@ -39,9 +38,9 @@
     protected Locale locale;
     protected ImageWriterSpi originatingProvider;
     protected Object output;
-    protected List progressListeners;
-    protected List warningListeners;
-    protected List warningLocales;
+    protected List<IIOWriteProgressListener> progressListeners;
+    protected List<IIOWriteWarningListener> warningListeners;
+    protected List<Locale> warningLocales;
 
 
     protected ImageWriter(ImageWriterSpi originatingProvider) {
@@ -61,8 +60,7 @@
 
     protected void processImageStarted(int imageIndex) {
         if (null != progressListeners) {
-            for (Iterator iterator = progressListeners.iterator(); iterator.hasNext();) {
-                IIOWriteProgressListener listener = (IIOWriteProgressListener) iterator.next();
+            for (IIOWriteProgressListener listener : progressListeners) {
                 listener.imageStarted(this, imageIndex);
             }
         }
@@ -70,8 +68,7 @@
 
     protected void processImageProgress(float percentageDone) {
         if (null != progressListeners) {
-            for (Iterator iterator = progressListeners.iterator(); iterator.hasNext();) {
-                IIOWriteProgressListener listener = (IIOWriteProgressListener) iterator.next();
+            for (IIOWriteProgressListener listener : progressListeners) {
                 listener.imageProgress(this, percentageDone);
             }
         }
@@ -79,8 +76,7 @@
 
     protected void processImageComplete() {
         if (null != progressListeners) {
-            for (Iterator iterator = progressListeners.iterator(); iterator.hasNext();) {
-                IIOWriteProgressListener listener = (IIOWriteProgressListener) iterator.next();
+            for (IIOWriteProgressListener listener : progressListeners) {
                 listener.imageComplete(this);
             }
         }
@@ -91,8 +87,7 @@
             throw new NullPointerException("warning message should not be NULL");
         }
         if (null != warningListeners) {
-            for (Iterator iterator = warningListeners.iterator(); iterator.hasNext();) {
-                IIOWriteWarningListener listener = (IIOWriteWarningListener) iterator.next();
+            for (IIOWriteWarningListener listener : warningListeners) {
                 listener.warningOccurred(this, imageIndex, warning);
             }
         }
@@ -108,8 +103,8 @@
             if (null != spi) {
                 Class[] outTypes = spi.getOutputTypes();
                 boolean supported = false;
-                for(int i = 0; i < outTypes.length; i++) {
-                    if (outTypes[i].isInstance(output)) {
+                for (Class<?> element : outTypes) {
+                    if (element.isInstance(output)) {
                         supported = true;
                         break;
                     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/plugins/jpeg/JPEGQTable.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/plugins/jpeg/JPEGQTable.java?view=diff&rev=463126&r1=463125&r2=463126
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/plugins/jpeg/JPEGQTable.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/plugins/jpeg/JPEGQTable.java Wed Oct 11 20:41:03 2006
@@ -69,11 +69,11 @@
         if (table.length != SIZE) {
             throw new IllegalArgumentException("illegal table size: " + table.length);
         }
-        theTable = (int[]) table.clone();
+        theTable = table.clone();
     }
 
     public int[] getTable() {
-        return (int[]) theTable.clone();
+        return theTable.clone();
     }
 
     public JPEGQTable getScaledInstance(float scaleFactor, boolean forceBaseline) {
@@ -94,6 +94,7 @@
         return new JPEGQTable(table);
     }
 
+    @Override
     public String toString() {
         //-- TODO more informative info
         return "JPEGQTable";

Modified: incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/spi/IIORegistry.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/spi/IIORegistry.java?view=diff&rev=463126&r1=463125&r2=463126
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/spi/IIORegistry.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/spi/IIORegistry.java Wed Oct 11 20:41:03 2006
@@ -20,16 +20,13 @@
  */
 package javax.imageio.spi;
 
-import org.apache.harmony.x.imageio.plugins.jpeg.JPEGImageWriterSpi;
+import java.util.Arrays;
 import org.apache.harmony.x.imageio.plugins.jpeg.JPEGImageReaderSpi;
-import org.apache.harmony.x.imageio.spi.FileIOSSpi;
-import org.apache.harmony.x.imageio.spi.RAFIOSSpi;
+import org.apache.harmony.x.imageio.plugins.jpeg.JPEGImageWriterSpi;
 import org.apache.harmony.x.imageio.spi.FileIISSpi;
+import org.apache.harmony.x.imageio.spi.FileIOSSpi;
 import org.apache.harmony.x.imageio.spi.RAFIISSpi;
-
-import java.util.Arrays;
-
-import org.apache.harmony.awt.datatransfer.*;
+import org.apache.harmony.x.imageio.spi.RAFIOSSpi;
 
 /**
  * @author Rustem V. Rafikov
@@ -37,7 +34,7 @@
  */
 public final class IIORegistry extends ServiceRegistry {
 
-    private static volatile IIORegistry instance;
+    private static IIORegistry instance;
 
     private static final Class[] CATEGORIES = new Class[] {
         javax.imageio.spi.ImageWriterSpi.class,
@@ -48,7 +45,7 @@
     };
 
     private IIORegistry() {
-        super(Arrays.asList(CATEGORIES).iterator());
+        super(Arrays.<Class<?>>asList(CATEGORIES).iterator());
         registerBuiltinSpis();
         registerApplicationClasspathSpis();
     }
@@ -65,14 +62,12 @@
 
     public static IIORegistry getDefaultInstance() {
         // TODO implement own instance for each ThreadGroup (see also ThreadLocal)
-        if (instance == null) {
-            synchronized(IIORegistry.class) {
-                if (instance == null) {
-                    instance = new IIORegistry();
-                }
+        synchronized (IIORegistry.class) {
+            if (instance == null) {
+                instance = new IIORegistry();
             }
+            return instance;
         }
-        return instance;
     }
 
     public void registerApplicationClasspathSpis() {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/spi/IIOServiceProvider.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/spi/IIOServiceProvider.java?view=diff&rev=463126&r1=463125&r2=463126
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/spi/IIOServiceProvider.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/spi/IIOServiceProvider.java Wed Oct 11 20:41:03 2006
@@ -42,11 +42,11 @@
         throw new UnsupportedOperationException("Not supported yet");
     }
 
-    public void onRegistration(ServiceRegistry registry, Class category) {
+    public void onRegistration(ServiceRegistry registry, Class<?> category) {
         // the default impl. does nothing
     }
 
-    public void onDeregistration(ServiceRegistry registry, Class category) {
+    public void onDeregistration(ServiceRegistry registry, Class<?> category) {
         throw new UnsupportedOperationException("Not supported yet");
     }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/spi/ImageInputStreamSpi.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/spi/ImageInputStreamSpi.java?view=diff&rev=463126&r1=463125&r2=463126
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/spi/ImageInputStreamSpi.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/spi/ImageInputStreamSpi.java Wed Oct 11 20:41:03 2006
@@ -20,26 +20,24 @@
  */
 package javax.imageio.spi;
 
-import javax.imageio.stream.ImageInputStream;
-import java.util.Locale;
-import java.io.IOException;
 import java.io.File;
+import java.io.IOException;
+import javax.imageio.stream.ImageInputStream;
 
-public abstract class ImageInputStreamSpi extends IIOServiceProvider
-        implements RegisterableService {
-
-    protected Class inputClass;
+public abstract class ImageInputStreamSpi extends IIOServiceProvider implements
+        RegisterableService {
+    protected Class<?> inputClass;
 
     protected ImageInputStreamSpi() {
         throw new UnsupportedOperationException("Not supported yet");
     }
 
-    public ImageInputStreamSpi(String vendorName, String version, Class inputClass) {
+    public ImageInputStreamSpi(String vendorName, String version, Class<?> inputClass) {
         super(vendorName, version);
         this.inputClass = inputClass;
     }
 
-    public Class getInputClass() {
+    public Class<?> getInputClass() {
         return inputClass;
     }
 
@@ -51,9 +49,8 @@
         return false; // def
     }
 
-    public abstract ImageInputStream createInputStreamInstance(Object input,
-                    boolean useCache, File cacheDir)
-            throws IOException;
+    public abstract ImageInputStream createInputStreamInstance(Object input, boolean useCache,
+            File cacheDir) throws IOException;
 
     public ImageInputStream createInputStreamInstance(Object input) throws IOException {
         return createInputStreamInstance(input, true, null);

Modified: incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/spi/ImageOutputStreamSpi.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/spi/ImageOutputStreamSpi.java?view=diff&rev=463126&r1=463125&r2=463126
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/spi/ImageOutputStreamSpi.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/spi/ImageOutputStreamSpi.java Wed Oct 11 20:41:03 2006
@@ -21,25 +21,23 @@
 package javax.imageio.spi;
 
 import javax.imageio.stream.ImageOutputStream;
-import java.util.Locale;
 import java.io.IOException;
 import java.io.File;
 
-public abstract class ImageOutputStreamSpi extends IIOServiceProvider
-        implements RegisterableService {
-
-    protected Class outputClass;
+public abstract class ImageOutputStreamSpi extends IIOServiceProvider implements
+        RegisterableService {
+    protected Class<?> outputClass;
 
     protected ImageOutputStreamSpi() {
         throw new UnsupportedOperationException("Not supported yet");
     }
 
-    public ImageOutputStreamSpi(String vendorName, String version, Class outputClass) {
+    public ImageOutputStreamSpi(String vendorName, String version, Class<?> outputClass) {
         super(vendorName, version);
         this.outputClass = outputClass;
     }
 
-    public Class getOutputClass() {
+    public Class<?> getOutputClass() {
         return outputClass;
     }
 
@@ -51,11 +49,10 @@
         return false; // def
     }
 
-    public ImageOutputStream createOutputStreamInstance(Object output)
-                                             throws IOException {
+    public ImageOutputStream createOutputStreamInstance(Object output) throws IOException {
         return createOutputStreamInstance(output, true, null);
     }
 
     public abstract ImageOutputStream createOutputStreamInstance(Object output,
-                    boolean useCache, File cacheDir) throws IOException;
+            boolean useCache, File cacheDir) throws IOException;
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/spi/ImageReaderWriterSpi.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/spi/ImageReaderWriterSpi.java?view=diff&rev=463126&r1=463125&r2=463126
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/spi/ImageReaderWriterSpi.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/spi/ImageReaderWriterSpi.java Wed Oct 11 20:41:03 2006
@@ -61,7 +61,7 @@
         }
 
         if (pluginClassName == null) {
-            throw new NullPointerException("Plugin class name cannot bu NULL");
+            throw new NullPointerException("Plugin class name cannot be NULL");
         }
 
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/spi/RegisterableService.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/spi/RegisterableService.java?view=diff&rev=463126&r1=463125&r2=463126
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/spi/RegisterableService.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/spi/RegisterableService.java Wed Oct 11 20:41:03 2006
@@ -21,6 +21,6 @@
 package javax.imageio.spi;
 
 public interface RegisterableService {
-    void onRegistration(ServiceRegistry registry, Class category);
-    void onDeregistration(ServiceRegistry registry, Class category);
+    void onRegistration(ServiceRegistry registry, Class<?> category);
+    void onDeregistration(ServiceRegistry registry, Class<?> category);
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/spi/ServiceRegistry.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/spi/ServiceRegistry.java?view=diff&rev=463126&r1=463125&r2=463126
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/spi/ServiceRegistry.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/spi/ServiceRegistry.java Wed Oct 11 20:41:03 2006
@@ -21,6 +21,7 @@
 package javax.imageio.spi;
 
 import java.util.*;
+import java.util.Map.Entry;
 
 /**
  * TODO: add all the methods from the spec
@@ -29,30 +30,30 @@
 
     CategoriesMap categories = new CategoriesMap(this);
 
-    public ServiceRegistry(Iterator categoriesIterator) {
+    public ServiceRegistry(Iterator<Class<?>> categoriesIterator) {
         if (null == categoriesIterator) {
             throw new IllegalArgumentException("categories iterator should not be NULL");
         }
         while(categoriesIterator.hasNext()) {
-            Class c =  (Class) categoriesIterator.next();
+            Class<?> c =  categoriesIterator.next();
             categories.addCategory(c);
         }
     }
 
-    public static Iterator lookupProviders(Class providerClass, ClassLoader loader) {
+    public static <T> Iterator<T> lookupProviders(Class<T> providerClass, ClassLoader loader) {
         throw new UnsupportedOperationException("Not supported yet");
     }
 
-    public static Iterator lookupProviders(Class providerClass) {
-        throw new UnsupportedOperationException("Not supported yet");
+    public static <T> Iterator<T> lookupProviders(Class<T> providerClass) {
+        return lookupProviders(providerClass, Thread.currentThread().getContextClassLoader());
     }
 
-    public boolean registerServiceProvider(Object provider, Class category) {
+    public <T> boolean registerServiceProvider(T provider, Class<T> category) {
         return categories.addProvider(provider, category);
     }
 
-    public void registerServiceProviders(Iterator providers) {
-        for (Iterator iterator = providers; iterator.hasNext();) {
+    public void registerServiceProviders(Iterator<?> providers) {
+        for (Iterator<?> iterator = providers; iterator.hasNext();) {
             categories.addProvider(iterator.next(), null);
         }
     }
@@ -61,7 +62,7 @@
         categories.addProvider(provider, null);
     }
 
-    public boolean deregisterServiceProvider(Object provider, Class category) {
+    public <T> boolean deregisterServiceProvider(T provider, Class<T> category) {
         throw new UnsupportedOperationException("Not supported yet");
     }
 
@@ -69,27 +70,29 @@
         throw new UnsupportedOperationException("Not supported yet");
     }
 
-    public Iterator getServiceProviders(Class category, Filter filter, boolean useOrdering) {
-        return new FilteredIterator(filter, categories.getProviders(category, useOrdering));
+    @SuppressWarnings("unchecked")
+    public <T> Iterator<T> getServiceProviders(Class<T> category, Filter filter, boolean useOrdering) {
+        return new FilteredIterator<T>(filter, (Iterator<T>)categories.getProviders(category, useOrdering));
     }
 
-    public Iterator getServiceProviders(Class category, boolean useOrdering) {
-        return categories.getProviders(category, useOrdering);
+    @SuppressWarnings("unchecked")
+    public <T> Iterator<T> getServiceProviders(Class<T> category, boolean useOrdering) {
+        return (Iterator<T>)categories.getProviders(category, useOrdering);
     }
 
-    public Object getServiceProviderByClass(Class providerClass) {
+    public <T> T getServiceProviderByClass(Class<T> providerClass) {
         throw new UnsupportedOperationException("Not supported yet");
     }
 
-    public boolean setOrdering(Class category, Object firstProvider, Object secondProvider) {
+    public <T> boolean setOrdering(Class<T> category, T firstProvider, T secondProvider) {
         throw new UnsupportedOperationException("Not supported yet");
     }
 
-    public boolean unsetOrdering(Class category, Object firstProvider, Object secondProvider) {
+    public <T> boolean unsetOrdering(Class<T> category, T firstProvider, T secondProvider) {
         throw new UnsupportedOperationException("Not supported yet");
     }
 
-    public void deregisterAll(Class category) {
+    public void deregisterAll(Class<?> category) {
         throw new UnsupportedOperationException("Not supported yet");
     }
 
@@ -97,15 +100,17 @@
         throw new UnsupportedOperationException("Not supported yet");
     }
 
+    @Override
     public void finalize() throws Throwable {
-        //-- TODO
+        //TODO uncomment when deregisterAll is implemented
+        //deregisterAll();
     }
 
     public boolean contains(Object provider) {
         throw new UnsupportedOperationException("Not supported yet");
     }
 
-    public Iterator getCategories() {
+    public Iterator<Class<?>> getCategories() {
         return categories.list();
     }
 
@@ -114,8 +119,7 @@
     }
 
     private static class CategoriesMap {
-        //-- <category class> -> ProvidersMap (Map)
-        Map categories = new HashMap();
+        Map<Class<?>, ProvidersMap> categories = new HashMap<Class<?>, ProvidersMap>();
 
         ServiceRegistry registry;
 
@@ -124,19 +128,19 @@
         }
 
         //-- TODO: useOrdering
-        Iterator getProviders(Class category, boolean useOrdering) {
-            ProvidersMap providers = (ProvidersMap) categories.get(category);
+        Iterator<?> getProviders(Class<?> category, boolean useOrdering) {
+            ProvidersMap providers = categories.get(category);
             if (null == providers) {
                 throw new IllegalArgumentException("Unknown category: " + category);
             }
             return providers.getProviders(useOrdering);
         }
 
-        Iterator list() {
+        Iterator<Class<?>> list() {
             return categories.keySet().iterator();
         }
 
-        void addCategory(Class category) {
+        void addCategory(Class<?> category) {
             categories.put(category, new ProvidersMap());
         }
 
@@ -148,7 +152,7 @@
          * @param category category to add provider to
          * @return if there were such provider in some category
          */
-        boolean addProvider(Object provider, Class category) {
+        boolean addProvider(Object provider, Class<?> category) {
             if (provider == null) {
                 throw new IllegalArgumentException("provider should be != NULL");
             }
@@ -167,7 +171,7 @@
             return rt;
         }
 
-        private boolean addToNamed(Object provider, Class category) {
+        private boolean addToNamed(Object provider, Class<?> category) {
             Object obj = categories.get(category);
 
             if (null == obj) {
@@ -179,10 +183,9 @@
 
         private boolean findAndAdd(Object provider) {
             boolean rt = false;
-            for (Iterator iterator = categories.entrySet().iterator(); iterator.hasNext();) {
-                Map.Entry e = (Map.Entry) iterator.next();
-                if (((Class)e.getKey()).isAssignableFrom(provider.getClass())) {
-                    rt |= ((ProvidersMap) e.getValue()).addProvider(provider);
+            for (Entry<Class<?>, ProvidersMap> e : categories.entrySet()) {
+                if (e.getKey().isAssignableFrom(provider.getClass())) {
+                    rt |= e.getValue().addProvider(provider);
                 }
             }
             return rt;
@@ -192,39 +195,39 @@
     private static class ProvidersMap {
         //-- TODO: providers ordering support
 
-        Map providers = new HashMap();
+        Map<Class<?>, Object> providers = new HashMap<Class<?>, Object>();
 
         boolean addProvider(Object provider) {
             return providers.put(provider.getClass(), provider) != null;
         }
 
-        Iterator getProviderClasses() {
+        Iterator<Class<?>> getProviderClasses() {
             return providers.keySet().iterator();
         }
 
         //-- TODO ordering
-        Iterator getProviders(boolean userOrdering) {
+        Iterator<?> getProviders(boolean userOrdering) {
             return providers.values().iterator();
         }
     }
 
-    private static class FilteredIterator implements Iterator {
+    private static class FilteredIterator<E> implements Iterator<E> {
 
         private Filter filter;
-        private Iterator backend;
-        private Object nextObj;
+        private Iterator<E> backend;
+        private E nextObj;
 
-        public FilteredIterator(Filter filter, Iterator backend) {
+        public FilteredIterator(Filter filter, Iterator<E> backend) {
             this.filter = filter;
             this.backend = backend;
             findNext();
         }
 
-        public Object next() {
+        public E next() {
             if (nextObj == null) {
                 throw new NoSuchElementException();
             }
-            Object tmp = nextObj;
+            E tmp = nextObj;
             findNext();
             return tmp;
         }
@@ -234,7 +237,7 @@
         }
 
         public void remove() {
-            throw new UnsupportedOperationException("???");
+            throw new UnsupportedOperationException();
         }
 
         /**
@@ -243,7 +246,7 @@
         private void findNext() {
             nextObj = null;
             while (backend.hasNext()) {
-                Object o = backend.next();
+                E o = backend.next();
                 if (filter.filter(o)) {
                     nextObj = o;
                     return;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/stream/FileImageOutputStream.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/stream/FileImageOutputStream.java?view=diff&rev=463126&r1=463125&r2=463126
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/stream/FileImageOutputStream.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/stream/FileImageOutputStream.java Wed Oct 11 20:41:03 2006
@@ -39,6 +39,7 @@
         file = raf;
     }
 
+    @Override
     public void write(int b) throws IOException {
         checkClosed();
         // according to the spec for ImageOutputStreamImpl#flushBits()
@@ -47,6 +48,7 @@
         streamPos++;
     }
 
+    @Override
     public void write(byte[] b, int off, int len) throws IOException {
         checkClosed();
         // according to the spec for ImageOutputStreamImpl#flushBits()
@@ -55,6 +57,7 @@
         streamPos += len;
     }
 
+    @Override
     public int read() throws IOException {
         checkClosed();
         int rt = file.read();
@@ -64,6 +67,7 @@
         return rt;
     }
 
+    @Override
     public int read(byte[] b, int off, int len) throws IOException {
         checkClosed();
         int rt = file.read(b, off, len);
@@ -73,6 +77,7 @@
         return rt;
     }
 
+    @Override
     public long length() {
         try {
             checkClosed();
@@ -82,6 +87,7 @@
         }
     }
 
+    @Override
     public void seek(long pos) throws IOException {
         //-- checkClosed() is performed in super.seek()
         super.seek(pos);
@@ -89,6 +95,7 @@
         streamPos = file.getFilePointer();
     }
 
+    @Override
     public void close() throws IOException {
         super.close();
         file.close();

Modified: incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/stream/ImageInputStreamImpl.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/stream/ImageInputStreamImpl.java?view=diff&rev=463126&r1=463125&r2=463126
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/stream/ImageInputStreamImpl.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/javax/imageio/stream/ImageInputStreamImpl.java Wed Oct 11 20:41:03 2006
@@ -20,10 +20,9 @@
  */
 package javax.imageio.stream;
 
-import java.nio.ByteOrder;
-import java.io.IOException;
 import java.io.EOFException;
-import java.util.Stack;
+import java.io.IOException;
+import java.nio.ByteOrder;
 
 public abstract class ImageInputStreamImpl implements ImageInputStream {
 
@@ -35,7 +34,7 @@
 
     private boolean closed = false;
 
-    private PositionStack posStack = new PositionStack();
+    private final PositionStack posStack = new PositionStack();
 
     public ImageInputStreamImpl() {}
 
@@ -300,11 +299,14 @@
 
     }
 
+    @Override
     protected void finalize() throws Throwable {
-        if (!closed) try {
-            close();
-        } finally {
-            super.finalize();
+        if (!closed) {
+            try {
+                close();
+            } finally {
+                super.finalize();
+            }
         }
     }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/plugins/jpeg/IISDecodingImageSource.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/plugins/jpeg/IISDecodingImageSource.java?view=diff&rev=463126&r1=463125&r2=463126
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/plugins/jpeg/IISDecodingImageSource.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/plugins/jpeg/IISDecodingImageSource.java Wed Oct 11 20:41:03 2006
@@ -35,16 +35,18 @@
  */
 public class IISDecodingImageSource extends DecodingImageSource {
 
-    private InputStream is;
+    private final InputStream is;
 
     public IISDecodingImageSource(ImageInputStream iis) {
         is = new IISToInputStreamWrapper(iis);
     }
 
+    @Override
     protected boolean checkConnection() {
         return true;
     }
 
+    @Override
     protected InputStream getInputStream() {
         return is;
     }
@@ -57,34 +59,42 @@
             this.input=input;
         }
 
+        @Override
         public int read() throws IOException {
             return input.read();
         }
 
+        @Override
         public int read(byte[] b) throws IOException {
             return input.read(b);
         }
 
+        @Override
         public int read(byte[] b, int off, int len) throws IOException {
             return input.read(b, off, len);
         }
 
+        @Override
         public long skip(long n) throws IOException {
             return input.skipBytes(n);
         }
 
+        @Override
         public boolean markSupported() {
             return true;
         }
 
+        @Override
         public void mark(int readlimit) {
             input.mark();
         }
 
+        @Override
         public void reset() throws IOException {
             input.reset();
         }
 
+        @Override
         public void close() throws IOException {
             input.close();
         }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/plugins/jpeg/JPEGImageReader.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/plugins/jpeg/JPEGImageReader.java?view=diff&rev=463126&r1=463125&r2=463126
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/plugins/jpeg/JPEGImageReader.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/plugins/jpeg/JPEGImageReader.java Wed Oct 11 20:41:03 2006
@@ -23,6 +23,7 @@
 
 import javax.imageio.ImageReader;
 import javax.imageio.ImageReadParam;
+import javax.imageio.ImageTypeSpecifier;
 import javax.imageio.stream.ImageInputStream;
 import javax.imageio.metadata.IIOMetadata;
 import javax.imageio.spi.ImageReaderSpi;
@@ -51,36 +52,43 @@
         super(imageReaderSpi);
     }
 
+    @Override
     public int getHeight(int i) throws IOException {
         //-- TODO imlement
         throw new UnsupportedOperationException("not implemented yet");
     }
 
+    @Override
     public int getWidth(int i) throws IOException {
         //-- TODO imlement
         throw new UnsupportedOperationException("not implemented yet");
     }
 
+    @Override
     public int getNumImages(boolean b) throws IOException {
         //-- TODO imlement
         throw new UnsupportedOperationException("not implemented yet");
     }
 
-    public Iterator getImageTypes(int i) throws IOException {
+    @Override
+    public Iterator<ImageTypeSpecifier> getImageTypes(int i) throws IOException {
         //-- TODO imlement
         throw new UnsupportedOperationException("not implemented yet");
     }
 
+    @Override
     public IIOMetadata getStreamMetadata() throws IOException {
         //-- TODO imlement
         throw new UnsupportedOperationException("not implemented yet");
     }
 
+    @Override
     public IIOMetadata getImageMetadata(int i) throws IOException {
         //-- TODO imlement
         throw new UnsupportedOperationException("not implemented yet");
     }
 
+    @Override
     public BufferedImage read(int i, ImageReadParam imageReadParam) throws IOException {
         if (iis == null) {
             throw new IllegalArgumentException("input stream == null");
@@ -93,10 +101,12 @@
         return image.getBufferedImage();
     }
 
+    @Override
     public BufferedImage read(int i) throws IOException {
         return read(i, null);
     }
 
+    @Override
     public void setInput(Object input, boolean seekForwardOnly, boolean ignoreMetadata) {
         super.setInput(input, seekForwardOnly, ignoreMetadata);
         iis = (ImageInputStream) input;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/plugins/jpeg/JPEGImageReaderSpi.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/plugins/jpeg/JPEGImageReaderSpi.java?view=diff&rev=463126&r1=463125&r2=463126
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/plugins/jpeg/JPEGImageReaderSpi.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/plugins/jpeg/JPEGImageReaderSpi.java Wed Oct 11 20:41:03 2006
@@ -20,20 +20,13 @@
  */
 package org.apache.harmony.x.imageio.plugins.jpeg;
 
-
+import java.io.IOException;
+import java.util.Locale;
+import javax.imageio.ImageReader;
 import javax.imageio.spi.ImageReaderSpi;
 import javax.imageio.spi.ServiceRegistry;
-import javax.imageio.ImageReader;
 import javax.imageio.stream.ImageInputStream;
 
-import org.apache.harmony.awt.gl.image.DecodingImageSource;
-import org.apache.harmony.awt.gl.image.JpegDecoder;
-import org.apache.harmony.awt.gl.image.OffscreenImage;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Locale;
-
 public class JPEGImageReaderSpi extends ImageReaderSpi {
 
     public JPEGImageReaderSpi() {
@@ -54,6 +47,7 @@
     }
 
 
+    @Override
     public boolean canDecodeInput(Object source) throws IOException {
         ImageInputStream markable = (ImageInputStream) source;
         try {
@@ -75,15 +69,18 @@
         return false;
     }
 
+    @Override
     public ImageReader createReaderInstance(Object extension) throws IOException {
         return new JPEGImageReader(this);
     }
 
+    @Override
     public String getDescription(Locale locale) {
         return "DRL JPEG decoder";
     }
 
-    public void onRegistration(ServiceRegistry registry, Class category) {
+    @Override
+    public void onRegistration(ServiceRegistry registry, Class<?> category) {
         // super.onRegistration(registry, category);
     }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/plugins/jpeg/JPEGImageWriter.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/plugins/jpeg/JPEGImageWriter.java?view=diff&rev=463126&r1=463125&r2=463126
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/plugins/jpeg/JPEGImageWriter.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/plugins/jpeg/JPEGImageWriter.java Wed Oct 11 20:41:03 2006
@@ -63,6 +63,7 @@
         initWriterIds(ImageOutputStream.class);
     }
 
+    @Override
     public void write(IIOMetadata iioMetadata, IIOImage iioImage, ImageWriteParam param)
             throws IOException {
 
@@ -153,6 +154,7 @@
                 null, cinfo);
     }
 
+    @Override
     public void dispose() {
         super.dispose();
         if (cinfo != 0) {
@@ -171,14 +173,17 @@
         throw new UnsupportedOperationException("not supported yet");
     }
 
+    @Override
     public IIOMetadata convertStreamMetadata(IIOMetadata iioMetadata, ImageWriteParam imageWriteParam) {
         throw new UnsupportedOperationException("not supported yet");
     }
 
+    @Override
     public IIOMetadata convertImageMetadata(IIOMetadata iioMetadata, ImageTypeSpecifier imageTypeSpecifier, ImageWriteParam imageWriteParam) {
         throw new UnsupportedOperationException("not supported yet");
     }
 
+    @Override
     public void setOutput(Object output) {
         super.setOutput(output);
         ios = (ImageOutputStream) output;
@@ -202,7 +207,7 @@
      * Inits methods Ids for native to java callbacks
      * @param iosClass
      */
-    private native static void initWriterIds(Class iosClass);
+    private native static void initWriterIds(Class<ImageOutputStream> iosClass);
 
     /**
      * Inits compression objects
@@ -241,6 +246,7 @@
      * Callback for getting a next scanline
      * @param scanline scan line number
      */
+    @SuppressWarnings("unused")
     private void getScanLine(int scanline) {
         //-- TODO: processImageProgress in ImageWriter
         Raster child = sourceRaster.createChild(srcXOff,

Modified: incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/plugins/jpeg/JPEGImageWriterSpi.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/plugins/jpeg/JPEGImageWriterSpi.java?view=diff&rev=463126&r1=463125&r2=463126
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/plugins/jpeg/JPEGImageWriterSpi.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/plugins/jpeg/JPEGImageWriterSpi.java Wed Oct 11 20:41:03 2006
@@ -39,14 +39,17 @@
                 JPEGSpiConsts.extraImageMetadataFormatNames, JPEGSpiConsts.extraImageMetadataFormatClassNames);
     }
 
+    @Override
     public boolean canEncodeImage(ImageTypeSpecifier imageTypeSpecifier) {
         return true;
     }
 
+    @Override
     public ImageWriter createWriterInstance(Object o) throws IOException {
         return new JPEGImageWriter(this);
     }
 
+    @Override
     public String getDescription(Locale locale) {
         return "DRL JPEG Encoder";
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/spi/FileIISSpi.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/spi/FileIISSpi.java?view=diff&rev=463126&r1=463125&r2=463126
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/spi/FileIISSpi.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/spi/FileIISSpi.java Wed Oct 11 20:41:03 2006
@@ -28,22 +28,24 @@
 import java.util.Locale;
 
 public class FileIISSpi extends ImageInputStreamSpi {
-
     private static final String vendor = "Apache";
+
     private static final String ver = "0.1";
-    private static final Class clazz = File.class;
 
     public FileIISSpi() {
-        super(vendor, ver, clazz);
+        super(vendor, ver, File.class);
     }
 
-    public ImageInputStream createInputStreamInstance(Object input, boolean useCache, File cacheDir) throws IOException {
-        if (clazz.isInstance(input)) {
+    @Override
+    public ImageInputStream createInputStreamInstance(Object input, boolean useCache,
+            File cacheDir) throws IOException {
+        if (File.class.isInstance(input)) {
             return new FileImageOutputStream((File) input);
         }
-        throw new IllegalArgumentException("input is not an instance of " + clazz);
+        throw new IllegalArgumentException("input is not an instance of java.io.File");
     }
 
+    @Override
     public String getDescription(Locale locale) {
         return "File IIS Spi";
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/spi/FileIOSSpi.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/spi/FileIOSSpi.java?view=diff&rev=463126&r1=463125&r2=463126
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/spi/FileIOSSpi.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/spi/FileIOSSpi.java Wed Oct 11 20:41:03 2006
@@ -28,25 +28,24 @@
 import java.util.Locale;
 
 public class FileIOSSpi extends ImageOutputStreamSpi {
-
     private static final String vendor = "Apache";
-    private static final String ver = "0.1";
-    private static final Class clazz = File.class;
 
+    private static final String ver = "0.1";
 
     public FileIOSSpi() {
-        super(vendor, ver, clazz);
+        super(vendor, ver, File.class);
     }
 
-    public ImageOutputStream createOutputStreamInstance(Object output,
-                                                        boolean useCache,
-                                                        File cacheDir) throws IOException {
+    @Override
+    public ImageOutputStream createOutputStreamInstance(Object output, boolean useCache,
+            File cacheDir) throws IOException {
         if (output instanceof File) {
-            return new FileImageOutputStream((File)output);
+            return new FileImageOutputStream((File) output);
         }
         throw new IllegalArgumentException("output is not instance of File");
     }
 
+    @Override
     public String getDescription(Locale locale) {
         return "File IOS Spi";
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/spi/RAFIISSpi.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/spi/RAFIISSpi.java?view=diff&rev=463126&r1=463125&r2=463126
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/spi/RAFIISSpi.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/spi/RAFIISSpi.java Wed Oct 11 20:41:03 2006
@@ -29,24 +29,26 @@
 import java.util.Locale;
 
 public class RAFIISSpi extends ImageInputStreamSpi {
-
     private static final String vendor = "Apache";
+
     private static final String ver = "0.1";
-    private static final Class clazz = RandomAccessFile.class;
 
     public RAFIISSpi() {
-        super(vendor, ver, clazz);
+        super(vendor, ver, RandomAccessFile.class);
     }
 
-    public ImageInputStream createInputStreamInstance(Object input, boolean useCache, File cacheDir) throws IOException {
-        if (clazz.isInstance(input)) {
+    @Override
+    public ImageInputStream createInputStreamInstance(Object input, boolean useCache,
+            File cacheDir) throws IOException {
+        if (RandomAccessFile.class.isInstance(input)) {
             return new FileImageOutputStream((RandomAccessFile) input);
         }
-        throw new IllegalArgumentException("input is not an instance of " + clazz);
+        throw new IllegalArgumentException(
+                "input is not an instance of java.io.RandomAccessFile");
     }
 
+    @Override
     public String getDescription(Locale locale) {
         return "RandomAccessFile IIS Spi";
     }
 }
-

Modified: incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/spi/RAFIOSSpi.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/spi/RAFIOSSpi.java?view=diff&rev=463126&r1=463125&r2=463126
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/spi/RAFIOSSpi.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/imageio/src/main/java/org/apache/harmony/x/imageio/spi/RAFIOSSpi.java Wed Oct 11 20:41:03 2006
@@ -29,25 +29,24 @@
 import java.util.Locale;
 
 public class RAFIOSSpi extends ImageOutputStreamSpi {
-
     private static final String vendor = "Apache";
-    private static final String ver = "0.1";
-    private static final Class clazz = RandomAccessFile.class;
 
+    private static final String ver = "0.1";
 
     public RAFIOSSpi() {
-        super(vendor, ver, clazz);
+        super(vendor, ver, RandomAccessFile.class);
     }
 
-    public ImageOutputStream createOutputStreamInstance(Object output,
-                                                        boolean useCache,
-                                                        File cacheDir) throws IOException {
+    @Override
+    public ImageOutputStream createOutputStreamInstance(Object output, boolean useCache,
+            File cacheDir) throws IOException {
         if (output instanceof RandomAccessFile) {
-            return new FileImageOutputStream((RandomAccessFile)output);
+            return new FileImageOutputStream((RandomAccessFile) output);
         }
-        throw new IllegalArgumentException("output is not instance of File");
+        throw new IllegalArgumentException("output is not instance of java.io.RandomAccessFile");
     }
 
+    @Override
     public String getDescription(Locale locale) {
         return "RandomAccessFile IOS Spi";
     }



Mime
View raw message