diff --git a/awt/javax/imageio/IIOException.java b/awt/javax/imageio/IIOException.java
index fbfeb42..c77716c 100644
--- a/awt/javax/imageio/IIOException.java
+++ b/awt/javax/imageio/IIOException.java
@@ -18,22 +18,28 @@
  * @author Rustem V. Rafikov
  * @version $Revision: 1.3 $
  */
+
 package javax.imageio;
 
 import java.io.IOException;
 
 /**
  * The IIOException class indicates errors in reading/writing operations.
+ * 
+ * @since Android 1.0
  */
 public class IIOException extends IOException {
 
-    /** The Constant serialVersionUID. */
+    /**
+     * The Constant serialVersionUID.
+     */
     private static final long serialVersionUID = -3216210718638985251L;
 
     /**
      * Instantiates a new IIOException.
      * 
-     * @param message the detailed message.
+     * @param message
+     *            the detailed message.
      */
     public IIOException(String message) {
         super(message);
@@ -42,8 +48,10 @@
     /**
      * Instantiates a new IIOException.
      * 
-     * @param message the detailed message.
-     * @param cause the cause of this exception.
+     * @param message
+     *            the detailed message.
+     * @param cause
+     *            the cause of this exception.
      */
     public IIOException(String message, Throwable cause) {
         super(message);
diff --git a/awt/javax/imageio/IIOImage.java b/awt/javax/imageio/IIOImage.java
index e17a9fc..e9e5130 100644
--- a/awt/javax/imageio/IIOImage.java
+++ b/awt/javax/imageio/IIOImage.java
@@ -18,6 +18,7 @@
  * @author Rustem V. Rafikov
  * @version $Revision: 1.3 $
  */
+
 package javax.imageio;
 
 import javax.imageio.metadata.IIOMetadata;
@@ -27,33 +28,47 @@
 import java.util.List;
 
 /**
- * The IIOImage class combines the image, image's thumbnail and image's metadata.
- * The image can be presented as RenderedImage or Raster object.
+ * The IIOImage class combines the image, image's thumbnail and image's
+ * metadata. The image can be presented as RenderedImage or Raster object.
+ * 
+ * @since Android 1.0
  */
 public class IIOImage {
 
-    /** The image of this IIOImage. */
+    /**
+     * The image of this IIOImage.
+     */
     protected RenderedImage image;
-    
-    /** The raster of this IIOImage. */
+
+    /**
+     * The raster of this IIOImage.
+     */
     protected Raster raster;
-    
-    /** The list with thumbnails associated with the image. */
+
+    /**
+     * The list with thumbnails associated with the image.
+     */
     protected List<? extends BufferedImage> thumbnails;
-    
-    /** The metadata associated with the image. */
+
+    /**
+     * The metadata associated with the image.
+     */
     protected IIOMetadata metadata;
 
     /**
-     * Instantiates a new IIOImage with the specified RenderedImage, 
-     * list of thumbnails and metadata.
+     * Instantiates a new IIOImage with the specified RenderedImage, list of
+     * thumbnails and metadata.
      * 
-     * @param image the image specified by RenderedImage.
-     * @param thumbnails the list of BufferedImage objects which 
-     * represent the thumbnails of the image.
-     * @param metadata the metadata of the image.
+     * @param image
+     *            the image specified by RenderedImage.
+     * @param thumbnails
+     *            the list of BufferedImage objects which represent the
+     *            thumbnails of the image.
+     * @param metadata
+     *            the metadata of the image.
      */
-    public IIOImage(RenderedImage image, List<? extends BufferedImage> thumbnails, IIOMetadata metadata) {
+    public IIOImage(RenderedImage image, List<? extends BufferedImage> thumbnails,
+            IIOMetadata metadata) {
         if (image == null) {
             throw new IllegalArgumentException("image should not be NULL");
         }
@@ -64,13 +79,16 @@
     }
 
     /**
-     * Instantiates a new IIOImage with the specified Raster, list of
-     * thumbnails and metadata.
+     * Instantiates a new IIOImage with the specified Raster, list of thumbnails
+     * and metadata.
      * 
-     * @param raster the Raster.
-     * @param thumbnails the list of BufferedImage objects which 
-     * represent the thumbnails of Raster data.
-     * @param metadata the metadata.
+     * @param raster
+     *            the Raster.
+     * @param thumbnails
+     *            the list of BufferedImage objects which represent the
+     *            thumbnails of Raster data.
+     * @param metadata
+     *            the metadata.
      */
     public IIOImage(Raster raster, List<? extends BufferedImage> thumbnails, IIOMetadata metadata) {
         if (raster == null) {
@@ -83,11 +101,11 @@
     }
 
     /**
-     * Gets the RenderedImage object or returns null if this IIOImage 
-     * object is associated with a Raster.
+     * Gets the RenderedImage object or returns null if this IIOImage object is
+     * associated with a Raster.
      * 
-     * @return the RenderedImage object or null if this IIOImage 
-     * object is associated with a Raster.
+     * @return the RenderedImage object or null if this IIOImage object is
+     *         associated with a Raster.
      */
     public RenderedImage getRenderedImage() {
         return image;
@@ -96,7 +114,8 @@
     /**
      * Sets the RenderedImage to this IIOImage object.
      * 
-     * @param image the RenderedImage to be set to this IIOImage.
+     * @param image
+     *            the RenderedImage to be set to this IIOImage.
      */
     public void setRenderedImage(RenderedImage image) {
         if (image == null) {
@@ -107,11 +126,11 @@
     }
 
     /**
-     * Returns true if the IIOImage object associated with a Raster, or 
-     * false if it's associated with a RenderedImage.
+     * Returns true if the IIOImage object associated with a Raster, or false if
+     * it's associated with a RenderedImage.
      * 
-     * @return true if the IIOImage object associated with a Raster, or 
-     * false if it's associated with a RenderedImage.
+     * @return true, if the IIOImage object associated with a Raster, or false
+     *         if it's associated with a RenderedImage.
      */
     public boolean hasRaster() {
         return raster != null;
@@ -121,8 +140,8 @@
      * Gets the Raster object or returns null if this IIOImage object is
      * associated with a RenderedImage.
      * 
-     * @return the Raster or null if this IIOImage object
-     * is associated with a RenderedImage.
+     * @return the Raster or null if this IIOImage object is associated with a
+     *         RenderedImage.
      */
     public Raster getRaster() {
         return raster;
@@ -131,7 +150,8 @@
     /**
      * Sets the Raster to the IIOImage.
      * 
-     * @param raster the new Raster to the IIOImage.
+     * @param raster
+     *            the new Raster to the IIOImage.
      */
     public void setRaster(Raster raster) {
         if (raster == null) {
@@ -153,8 +173,8 @@
     /**
      * Gets the thumbnail with the specified index in the list.
      * 
-     * @param index the index of the thumbnail in the list.
-     * 
+     * @param index
+     *            the index of the thumbnail in the list.
      * @return the thumbnail with the specified index in the list.
      */
     public BufferedImage getThumbnail(int index) {
@@ -176,8 +196,8 @@
     /**
      * Sets the list of thumbnails images to this IIOImage object.
      * 
-     * @param thumbnails the list of BufferedImage which represent
-     * thumbnails.
+     * @param thumbnails
+     *            the list of BufferedImage which represent thumbnails.
      */
     public void setThumbnails(List<? extends BufferedImage> thumbnails) {
         this.thumbnails = thumbnails;
@@ -195,7 +215,8 @@
     /**
      * Sets the metadata to this IIOImage object.
      * 
-     * @param metadata the IIOMetadata, or null.
+     * @param metadata
+     *            the IIOMetadata, or null.
      */
     public void setMetadata(IIOMetadata metadata) {
         this.metadata = metadata;
diff --git a/awt/javax/imageio/IIOParam.java b/awt/javax/imageio/IIOParam.java
index d998b6e..2ccc945 100644
--- a/awt/javax/imageio/IIOParam.java
+++ b/awt/javax/imageio/IIOParam.java
@@ -18,56 +18,80 @@
  * @author Rustem V. Rafikov
  * @version $Revision: 1.3 $
  */
+
 package javax.imageio;
 
 import java.awt.*;
 
 /**
- * The IIOParam abstract class is superclass for     
- * ImageReadParam and ImageWriteParam classes and provides 
- * methods and variables which they share.
+ * The IIOParam abstract class is superclass for ImageReadParam and
+ * ImageWriteParam classes and provides methods and variables which they share.
+ * 
+ * @since Android 1.0
  */
 public abstract class IIOParam {
-    
-    /** The source region. */
+
+    /**
+     * The source region.
+     */
     protected Rectangle sourceRegion;
-    
-    /** The source x subsampling. */
+
+    /**
+     * The source x subsampling.
+     */
     protected int sourceXSubsampling = 1;
-    
-    /** The source y subsampling. */
+
+    /**
+     * The source y subsampling.
+     */
     protected int sourceYSubsampling = 1;
-    
-    /** The subsampling x offset. */
+
+    /**
+     * The subsampling x offset.
+     */
     protected int subsamplingXOffset;
-    
-    /** The subsampling y offset. */
+
+    /**
+     * The subsampling y offset.
+     */
     protected int subsamplingYOffset;
-    
-    /** The source bands. */
+
+    /**
+     * The source bands.
+     */
     protected int[] sourceBands;
-    
-    /** The destination type. */
+
+    /**
+     * The destination type.
+     */
     protected ImageTypeSpecifier destinationType;
-    
-    /** The destination offset. */
+
+    /**
+     * The destination offset.
+     */
     protected Point destinationOffset = new Point(0, 0);
-    
-    /** The default controller. */
+
+    /**
+     * The default controller.
+     */
     protected IIOParamController defaultController;
-    
-    /** The controller. */
+
+    /**
+     * The controller.
+     */
     protected IIOParamController controller;
 
     /**
      * Instantiates a new IIOParam.
      */
-    protected IIOParam() {}
+    protected IIOParam() {
+    }
 
     /**
      * Sets the source region as a Rectangle object.
      * 
-     * @param sourceRegion the Rectangle which specifies the source region.
+     * @param sourceRegion
+     *            the Rectangle which specifies the source region.
      */
     public void setSourceRegion(Rectangle sourceRegion) {
         if (sourceRegion != null) {
@@ -91,8 +115,8 @@
             if (sourceRegion.height <= subsamplingYOffset) {
                 throw new IllegalArgumentException("height <= subsamplingXOffset");
             }
-            //-- clone it to avoid unexpected modifications
-            this.sourceRegion = (Rectangle) sourceRegion.clone();
+            // -- clone it to avoid unexpected modifications
+            this.sourceRegion = (Rectangle)sourceRegion.clone();
         } else {
             this.sourceRegion = null;
         }
@@ -107,24 +131,26 @@
         if (sourceRegion == null) {
             return null;
         }
-        //-- clone it to avoid unexpected modifications
-        return (Rectangle) sourceRegion.clone();
+        // -- clone it to avoid unexpected modifications
+        return (Rectangle)sourceRegion.clone();
     }
 
     /**
-     * Sets the source subsampling. The sourceXSubsampling and 
-     * sourceYSubsampling parameters specify the number of rows 
-     * and columns to advance after every source pixel.
+     * Sets the source subsampling. The sourceXSubsampling and
+     * sourceYSubsampling parameters specify the number of rows and columns to
+     * advance after every source pixel.
      * 
-     * @param sourceXSubsampling the source X subsampling.
-     * @param sourceYSubsampling the source Y subsampling.
-     * @param subsamplingXOffset the subsampling X offset.
-     * @param subsamplingYOffset the subsampling Y offset.
+     * @param sourceXSubsampling
+     *            the source X subsampling.
+     * @param sourceYSubsampling
+     *            the source Y subsampling.
+     * @param subsamplingXOffset
+     *            the subsampling X offset.
+     * @param subsamplingYOffset
+     *            the subsampling Y offset.
      */
-    public void setSourceSubsampling(int sourceXSubsampling,
-                                 int sourceYSubsampling,
-                                 int subsamplingXOffset,
-                                 int subsamplingYOffset) {
+    public void setSourceSubsampling(int sourceXSubsampling, int sourceYSubsampling,
+            int subsamplingXOffset, int subsamplingYOffset) {
 
         if (sourceXSubsampling <= 0) {
             throw new IllegalArgumentException("sourceXSubsampling <= 0");
@@ -141,10 +167,10 @@
             throw new IllegalArgumentException("subsamplingYOffset is wrong");
         }
 
-        //-- does region contain pixels
+        // -- does region contain pixels
         if (sourceRegion != null) {
-            if (sourceRegion.width <= subsamplingXOffset ||
-                    sourceRegion.height <= subsamplingYOffset) {
+            if (sourceRegion.width <= subsamplingXOffset
+                    || sourceRegion.height <= subsamplingYOffset) {
                 throw new IllegalArgumentException("there are no pixels in region");
             }
         }
@@ -156,8 +182,8 @@
     }
 
     /**
-     * Gets the source X subsampling - the number of source 
-     * columns to advance for each pixel.
+     * Gets the source X subsampling - the number of source columns to advance
+     * for each pixel.
      * 
      * @return the source X subsampling.
      */
@@ -166,8 +192,8 @@
     }
 
     /**
-     * Gets the source Y subsampling - the number of source 
-     * rows to advance for each pixel.
+     * Gets the source Y subsampling - the number of source rows to advance for
+     * each pixel.
      * 
      * @return the source Y subsampling.
      */
@@ -196,7 +222,8 @@
     /**
      * Sets the indices of the source bands.
      * 
-     * @param sourceBands the indices of the source bands.
+     * @param sourceBands
+     *            the indices of the source bands.
      */
     public void setSourceBands(int[] sourceBands) {
         // TODO implement
@@ -216,7 +243,8 @@
     /**
      * Sets the specified ImageTypeSpecifier for the destination image.
      * 
-     * @param destinationType the ImageTypeSpecifier.
+     * @param destinationType
+     *            the ImageTypeSpecifier.
      */
     public void setDestinationType(ImageTypeSpecifier destinationType) {
         // TODO implement
@@ -225,7 +253,7 @@
 
     /**
      * Gets the type of the destination image as an ImageTypeSpecifier. .
-     *  
+     * 
      * @return the ImageTypeSpecifier.
      */
     public ImageTypeSpecifier getDestinationType() {
@@ -234,18 +262,19 @@
     }
 
     /**
-     * Sets the offset in the destination image where 
-     * the decoded pixels are placed as a result of reading, 
-     * or specified an area to be written while writing operation.
+     * Sets the offset in the destination image where the decoded pixels are
+     * placed as a result of reading, or specified an area to be written while
+     * writing operation.
      * 
-     * @param destinationOffset the destination offset.
+     * @param destinationOffset
+     *            the destination offset.
      */
     public void setDestinationOffset(Point destinationOffset) {
         if (destinationOffset == null) {
             throw new IllegalArgumentException("destinationOffset == null!");
         }
-        
-        this.destinationOffset = (Point) destinationOffset.clone();
+
+        this.destinationOffset = (Point)destinationOffset.clone();
     }
 
     /**
@@ -254,14 +283,15 @@
      * @return the offset in the destination image.
      */
     public Point getDestinationOffset() {
-        return (Point) destinationOffset.clone();        
+        return (Point)destinationOffset.clone();
     }
 
     /**
-     * Sets the IIOParamController to this IIOParam object for
-     * providing settings to this IIOParam.
+     * Sets the IIOParamController to this IIOParam object for providing
+     * settings to this IIOParam.
      * 
-     * @param controller the new IIOParamController.
+     * @param controller
+     *            the new IIOParamController.
      */
     public void setController(IIOParamController controller) {
         // TODO implement
@@ -269,11 +299,9 @@
     }
 
     /**
-     * Gets the current IIOParamController controller 
-     * for this IIOParam.
+     * Gets the current IIOParamController controller for this IIOParam.
      * 
-     * @return the current IIOParamController controller 
-     * for this IIOParam.
+     * @return the current IIOParamController controller for this IIOParam.
      */
     public IIOParamController getController() {
         // TODO implement
@@ -281,11 +309,10 @@
     }
 
     /**
-     * Gets the default IIOParamController controller 
-     * for this IIOParam.
+     * Gets the default IIOParamController controller for this IIOParam.
      * 
-     * @return the default IIOParamController controller 
-     * for this IIOParam, or null.
+     * @return the default IIOParamController controller for this IIOParam, or
+     *         null.
      */
     public IIOParamController getDefaultController() {
         // TODO implement
@@ -293,11 +320,10 @@
     }
 
     /**
-     * Returns true if IIOParamController is installed for 
-     * this IIOParam. 
+     * Returns true if IIOParamController is installed for this IIOParam.
      * 
-     * @return true if IIOParamController is installed for 
-     * this IIOParam, false otherwise.
+     * @return true, if IIOParamController is installed for this IIOParam, false
+     *         otherwise.
      */
     public boolean hasController() {
         // TODO implement
diff --git a/awt/javax/imageio/IIOParamController.java b/awt/javax/imageio/IIOParamController.java
index 31522c1..338cb25 100644
--- a/awt/javax/imageio/IIOParamController.java
+++ b/awt/javax/imageio/IIOParamController.java
@@ -18,6 +18,7 @@
  * @author Sergey I. Salishev
  * @version $Revision: 1.2 $
  */
+
 package javax.imageio;
 
 /* 
@@ -26,18 +27,19 @@
  */
 
 /**
- * The IIOParamController specifies an activate method that invokes the 
+ * The IIOParamController specifies an activate method that invokes the
  * controller.
+ * 
+ * @since Android 1.0
  */
 public interface IIOParamController {
 
     /**
-     * Activates the controller. 
+     * Activates the controller.
      * 
-     * @param param the IIOParam.
-     * 
-     * @return true if the IIOParam has been modified, false otherwise.
+     * @param param
+     *            the IIOParam.
+     * @return true, if the IIOParam has been modified, false otherwise.
      */
     boolean activate(IIOParam param);
 }
-
diff --git a/awt/javax/imageio/ImageIO.java b/awt/javax/imageio/ImageIO.java
index d4cd1dd..e0d7ec9 100644
--- a/awt/javax/imageio/ImageIO.java
+++ b/awt/javax/imageio/ImageIO.java
@@ -18,6 +18,7 @@
  * @author Rustem V. Rafikov
  * @version $Revision: 1.3 $
  */
+
 package javax.imageio;
 
 import javax.imageio.stream.ImageInputStream;
@@ -34,44 +35,47 @@
 import java.net.URL;
 
 /**
- * The ImageIO class provides static methods to perfom 
- * reading and writing operations using registered
- * ImageReader and ImageWriter objects.
+ * The ImageIO class provides static methods to perform reading and writing
+ * operations using registered ImageReader and ImageWriter objects.
+ * 
+ * @since Android 1.0
  */
 public final class ImageIO {
 
-    /** The Constant registry. */
+    /**
+     * The constant registry.
+     */
     private static final IIORegistry registry = IIORegistry.getDefaultInstance();
 
     /**
-     * Instantiates a new image io.
+     * Instantiates a new ImageIO.
      */
-    private ImageIO() {}
-    
+    private ImageIO() {
+    }
 
     /**
-     * Scans for plug-ins in the class path, 
-     * loads spi classes, and registers them with the IIORegistry.
+     * Scans for plug-ins in the class path, loads spi classes, and registers
+     * them with the IIORegistry.
      */
     public static void scanForPlugins() {
         throw new UnsupportedOperationException("Not supported yet");
     }
 
     /**
-     * Sets flag which indicates whether a cache file is used when 
-     * creating ImageInputStreams and ImageOutputStreams or not.
+     * Sets flag which indicates whether a cache file is used when creating
+     * ImageInputStreams and ImageOutputStreams or not.
      * 
-     * @param useCache the use cache flag.
+     * @param useCache
+     *            the use cache flag.
      */
     public static void setUseCache(boolean useCache) {
         throw new UnsupportedOperationException("Not supported yet");
     }
 
     /**
-     * Gets the flag which indicates whether a cache file is used when 
-     * creating ImageInputStreams and ImageOutputStreams or not.
-     * This method returns the current value which is set by setUseCache
-     * method.
+     * Gets the flag which indicates whether a cache file is used when creating
+     * ImageInputStreams and ImageOutputStreams or not. This method returns the
+     * current value which is set by setUseCache method.
      * 
      * @return the use cache flag.
      */
@@ -83,44 +87,44 @@
     /**
      * Sets the cache directory.
      * 
-     * @param cacheDirectory the File which specifies a cache directory.
+     * @param cacheDirectory
+     *            the File which specifies a cache directory.
      */
     public static void setCacheDirectory(File cacheDirectory) {
         throw new UnsupportedOperationException("Not supported yet");
     }
 
     /**
-     * Gets the directory where cache files are created, returned
-     * the file which is set by setCacheDirectory method, or null.
+     * Gets the directory where cache files are created, returned the file which
+     * is set by setCacheDirectory method, or null.
      * 
-     * @return the File object which is set by setCacheDirectory method, 
-     * or null.
+     * @return the File object which is set by setCacheDirectory method, or
+     *         null.
      */
     public static File getCacheDirectory() {
         // TODO implement
-        //-- null indicates system-dep default temporary directory
+        // -- null indicates system-dep default temporary directory
         return null;
     }
 
     /**
-     * Creates an ImageInputStream from the specified Object.
-     * The specified Object should obtain the input source
-     * such as File, or InputStream.   
+     * Creates an ImageInputStream from the specified Object. The specified
+     * Object should obtain the input source such as File, or InputStream.
      * 
-     * @param input the input Object such as File, or InputStream.   
-     * 
+     * @param input
+     *            the input Object such as File, or InputStream.
      * @return the ImageInputStream object, or null.
-     * 
-     * @throws IOException signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
-    public static ImageInputStream createImageInputStream(Object input)
-            throws IOException {
+    public static ImageInputStream createImageInputStream(Object input) throws IOException {
 
         if (input == null) {
             throw new IllegalArgumentException("input source cannot be NULL");
         }
 
-        Iterator<ImageInputStreamSpi> it = registry.getServiceProviders(ImageInputStreamSpi.class, true);
+        Iterator<ImageInputStreamSpi> it = registry.getServiceProviders(ImageInputStreamSpi.class,
+                true);
 
         while (it.hasNext()) {
             ImageInputStreamSpi spi = it.next();
@@ -132,23 +136,22 @@
     }
 
     /**
-     * Creates an ImageOutputStream using the specified Object.
-     * The specified Object should obtain the output source
-     * such as File, or OutputStream.   
+     * Creates an ImageOutputStream using the specified Object. The specified
+     * Object should obtain the output source such as File, or OutputStream.
      * 
-     * @param output the output Object such as File, or OutputStream.   
-     * 
+     * @param output
+     *            the output Object such as File, or OutputStream.
      * @return the ImageOutputStream object, or null.
-     * 
-     * @throws IOException signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
-    public static ImageOutputStream createImageOutputStream(Object output)
-            throws IOException {
+    public static ImageOutputStream createImageOutputStream(Object output) throws IOException {
         if (output == null) {
             throw new IllegalArgumentException("output destination cannot be NULL");
         }
 
-        Iterator<ImageOutputStreamSpi> it = registry.getServiceProviders(ImageOutputStreamSpi.class, true);
+        Iterator<ImageOutputStreamSpi> it = registry.getServiceProviders(
+                ImageOutputStreamSpi.class, true);
 
         while (it.hasNext()) {
             ImageOutputStreamSpi spi = it.next();
@@ -161,8 +164,8 @@
     }
 
     /**
-     * Gets the array of format names as String which can be 
-     * decoded by registered ImageReader objects.
+     * Gets the array of format names as String which can be decoded by
+     * registered ImageReader objects.
      * 
      * @return the array of format names.
      */
@@ -171,8 +174,8 @@
     }
 
     /**
-     * Gets the array of MIME types as String which can be 
-     * decoded by registered ImageReader objects.
+     * Gets the array of MIME types as String which can be decoded by registered
+     * ImageReader objects.
      * 
      * @return the array of MIME types.
      */
@@ -181,13 +184,13 @@
     }
 
     /**
-     * Gets the Iterator of registered ImageReader which are able to 
-     * decode an imput data specified by input Object.
+     * Gets the Iterator of registered ImageReader which are able to decode an
+     * input data specified by input Object.
      * 
-     * @param input the input Object with encoded data such as 
-     * ImageInputStream object.
-     * 
-     * @return the Iterator of registered ImageReader. 
+     * @param input
+     *            the input Object with encoded data such as ImageInputStream
+     *            object.
+     * @return the Iterator of registered ImageReader.
      */
     public static Iterator<ImageReader> getImageReaders(Object input) {
         if (input == null) {
@@ -201,11 +204,11 @@
     }
 
     /**
-     * Gets the Iterator of registered ImageReader which are able to 
-     * decode the specified format.
+     * Gets the Iterator of registered ImageReader which are able to decode the
+     * specified format.
      * 
-     * @param formatName the format name such as "jpeg", or "gif".
-     * 
+     * @param formatName
+     *            the format name such as "jpeg", or "gif".
      * @return the Iterator of registered ImageReader.
      */
     public static Iterator<ImageReader> getImageReadersByFormatName(String formatName) {
@@ -220,11 +223,11 @@
     }
 
     /**
-     * Gets the Iterator which lists the registered ImageReader objects that
-     * are able to decode files with the specified suffix.
+     * Gets the Iterator which lists the registered ImageReader objects that are
+     * able to decode files with the specified suffix.
      * 
-     * @param fileSuffix the file suffix such as "jpg".
-     * 
+     * @param fileSuffix
+     *            the file suffix such as "jpg".
      * @return the Iterator of registered ImageReaders.
      */
     public static Iterator<ImageReader> getImageReadersBySuffix(String fileSuffix) {
@@ -238,11 +241,11 @@
     }
 
     /**
-     * Gets the Iterator of registered ImageReader objects that
-     * are able to decode files with the specified MIME type.
+     * Gets the Iterator of registered ImageReader objects that are able to
+     * decode files with the specified MIME type.
      * 
-     * @param MIMEType the MIME type such as "image/jpeg".
-     * 
+     * @param MIMEType
+     *            the MIME type such as "image/jpeg".
      * @return the Iterator of registered ImageReaders.
      */
     public static Iterator<ImageReader> getImageReadersByMIMEType(String MIMEType) {
@@ -250,8 +253,8 @@
     }
 
     /**
-     * Gets an array of Strings giving the names of the formats supported 
-     * by registered ImageWriter objects.
+     * Gets an array of Strings giving the names of the formats supported by
+     * registered ImageWriter objects.
      * 
      * @return the array of format names.
      */
@@ -260,7 +263,7 @@
     }
 
     /**
-     * Gets an array of Strings giving the MIME types of the formats supported 
+     * Gets an array of Strings giving the MIME types of the formats supported
      * by registered ImageWriter objects.
      * 
      * @return the array of MIME types.
@@ -270,11 +273,11 @@
     }
 
     /**
-     * Gets the Iterator which lists the registered ImageReader objects that
-     * are able to encode the specified image format.
+     * Gets the Iterator which lists the registered ImageReader objects that are
+     * able to encode the specified image format.
      * 
-     * @param formatName the image format name such as "jpeg".
-     * 
+     * @param formatName
+     *            the image format name such as "jpeg".
      * @return the Iterator of registered ImageWriter.
      */
     public static Iterator<ImageWriter> getImageWritersByFormatName(String formatName) {
@@ -289,11 +292,11 @@
     }
 
     /**
-     * Gets the Iterator which lists the registered ImageReader objects that
-     * are able to encode the specified suffix.
+     * Gets the Iterator which lists the registered ImageReader objects that are
+     * able to encode the specified suffix.
      * 
-     * @param fileSuffix the file suffix such as "jpg".
-     * 
+     * @param fileSuffix
+     *            the file suffix such as "jpg".
      * @return the Iterator of registered ImageWriter.
      */
     public static Iterator<ImageWriter> getImageWritersBySuffix(String fileSuffix) {
@@ -306,11 +309,11 @@
     }
 
     /**
-     * Gets the Iterator which lists the registered ImageReader objects that
-     * are able to encode the specified MIME type.
+     * Gets the Iterator which lists the registered ImageReader objects that are
+     * able to encode the specified MIME type.
      * 
-     * @param MIMEType the MIME type such as "image/jpeg".
-     * 
+     * @param MIMEType
+     *            the MIME type such as "image/jpeg".
      * @return the Iterator of registered ImageWriter.
      */
     public static Iterator<ImageWriter> getImageWritersByMIMEType(String MIMEType) {
@@ -318,12 +321,12 @@
     }
 
     /**
-     * Gets an ImageWriter object which corresponds to the 
-     * specified ImageReader, or returns null if the specified
-     * ImageReader is not registered. 
+     * Gets an ImageWriter object which corresponds to the specified
+     * ImageReader, or returns null if the specified ImageReader is not
+     * registered.
      * 
-     * @param reader the specified ImageReader.
-     * 
+     * @param reader
+     *            the specified ImageReader.
      * @return the ImageWriter, or null.
      */
     public static ImageWriter getImageWriter(ImageReader reader) {
@@ -331,12 +334,12 @@
     }
 
     /**
-     * Gets an ImageReader object which corresponds to the 
-     * specified ImageWriter, or returns null if the specified
-     * ImageWriter is not registered. 
+     * Gets an ImageReader object which corresponds to the specified
+     * ImageWriter, or returns null if the specified ImageWriter is not
+     * registered.
      * 
-     * @param writer the registered ImageWriter object.
-     * 
+     * @param writer
+     *            the registered ImageWriter object.
      * @return the ImageReader.
      */
     public static ImageReader getImageReader(ImageWriter writer) {
@@ -344,17 +347,16 @@
     }
 
     /**
-     * Gets the Iterator of ImageWriter objects which are able to
-     * encode images with the specified ImageTypeSpecifier and
-     * format.
+     * Gets the Iterator of ImageWriter objects which are able to encode images
+     * with the specified ImageTypeSpecifier and format.
      * 
-     * @param type the ImageTypeSpecifier, which defines layout.
-     * @param formatName the format name.
-     * 
+     * @param type
+     *            the ImageTypeSpecifier, which defines layout.
+     * @param formatName
+     *            the format name.
      * @return the Iterator of ImageWriter objects.
      */
-    public static Iterator<ImageWriter> getImageWriters(ImageTypeSpecifier type,
-                                           String formatName) {
+    public static Iterator<ImageWriter> getImageWriters(ImageTypeSpecifier type, String formatName) {
         if (type == null) {
             throw new NullPointerException("type cannot be NULL");
         }
@@ -370,31 +372,31 @@
     }
 
     /**
-     * Gets the Iterator of registered ImageTranscoders which 
-     * are able to transcode the metadata of the specified
-     * ImageReader object to a suitable object for encoding 
-     * by the specified ImageWriter.
+     * Gets the Iterator of registered ImageTranscoders which are able to
+     * transcode the metadata of the specified ImageReader object to a suitable
+     * object for encoding by the specified ImageWriter.
      * 
-     * @param reader the specified ImageReader.
-     * @param writer the specified ImageWriter.
-     * 
+     * @param reader
+     *            the specified ImageReader.
+     * @param writer
+     *            the specified ImageWriter.
      * @return the Iterator of registered ImageTranscoders.
      */
     public static Iterator<ImageTranscoder> getImageTranscoders(ImageReader reader,
-                                               ImageWriter writer) {
+            ImageWriter writer) {
         throw new UnsupportedOperationException("Not supported yet");
     }
 
     /**
-     * Reads image data from the specified File and decodes it using 
-     * the appropriate registered ImageReader object. 
-     * The File is wrapped in an ImageInputStream.
+     * Reads image data from the specified File and decodes it using the
+     * appropriate registered ImageReader object. The File is wrapped in an
+     * ImageInputStream.
      * 
-     * @param input the File to be read.
-     * 
+     * @param input
+     *            the File to be read.
      * @return the BufferedImage decoded from the specified File, or null.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public static BufferedImage read(File input) throws IOException {
         if (input == null) {
@@ -406,15 +408,15 @@
     }
 
     /**
-     * Reads image data from the specified InputStream and decodes it 
-     * using an appropriate registered an ImageReader object.
+     * Reads image data from the specified InputStream and decodes it using an
+     * appropriate registered an ImageReader object.
      * 
-     * @param input the InputStream.
-     * 
-     * @return the BufferedImage decoded from the specified InputStream,
-     * or null.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param input
+     *            the InputStream.
+     * @return the BufferedImage decoded from the specified InputStream, or
+     *         null.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public static BufferedImage read(InputStream input) throws IOException {
         if (input == null) {
@@ -426,14 +428,14 @@
     }
 
     /**
-     * Reads image data from the specified URL and decodes it using 
-     * the appropriate registered ImageReader object. 
-     *  
-     * @param input the URL to be read.
+     * Reads image data from the specified URL and decodes it using the
+     * appropriate registered ImageReader object.
      * 
+     * @param input
+     *            the URL to be read.
      * @return the BufferedImage decoded from the specified URL, or null.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public static BufferedImage read(URL input) throws IOException {
         if (input == null) {
@@ -443,20 +445,20 @@
         InputStream stream = input.openStream();
         BufferedImage res = read(stream);
         stream.close();
-        
+
         return res;
     }
 
     /**
-     * Reads image data from the specified ImageInputStream and decodes it 
-     * using appropriate registered an ImageReader object.
+     * Reads image data from the specified ImageInputStream and decodes it using
+     * appropriate registered an ImageReader object.
      * 
-     * @param stream the ImageInputStream.
-     * 
-     * @return the BufferedImage decoded from the specified ImageInputStream,
-     * or null.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param stream
+     *            the ImageInputStream.
+     * @return the BufferedImage decoded from the specified ImageInputStream, or
+     *         null.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public static BufferedImage read(ImageInputStream stream) throws IOException {
         if (stream == null) {
@@ -478,25 +480,25 @@
         } catch (IOException e) {
             // Stream could be already closed, proceed silently in this case
         }
-        
+
         return res;
     }
 
     /**
-     * Writes the specified image in the specified format (using an 
-     * appropriate ImageWriter) to the specified ImageOutputStream.
+     * Writes the specified image in the specified format (using an appropriate
+     * ImageWriter) to the specified ImageOutputStream.
      * 
-     * @param im the RenderedImage.
-     * @param formatName the format name.
-     * @param output the ImageOutputStream where Image to be written.
-     * 
+     * @param im
+     *            the RenderedImage.
+     * @param formatName
+     *            the format name.
+     * @param output
+     *            the ImageOutputStream where Image to be written.
      * @return true, if Image is written successfully, false otherwise.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
-    public static boolean write(RenderedImage im,
-                                String formatName,
-                                ImageOutputStream output)
+    public static boolean write(RenderedImage im, String formatName, ImageOutputStream output)
             throws IOException {
 
         if (im == null) {
@@ -509,7 +511,8 @@
             throw new IllegalArgumentException("output cannot be NULL");
         }
 
-        Iterator<ImageWriter> it = getImageWriters(ImageTypeSpecifier.createFromRenderedImage(im), formatName);
+        Iterator<ImageWriter> it = getImageWriters(ImageTypeSpecifier.createFromRenderedImage(im),
+                formatName);
         if (it.hasNext()) {
             ImageWriter writer = it.next();
             writer.setOutput(output);
@@ -522,20 +525,20 @@
     }
 
     /**
-     * Writes the specified image in the specified format (using an 
-     * appropriate ImageWriter) to the specified File.
+     * Writes the specified image in the specified format (using an appropriate
+     * ImageWriter) to the specified File.
      * 
-     * @param im the RenderedImage.
-     * @param formatName the format name.
-     * @param output the output File where Image to be written.
-     * 
+     * @param im
+     *            the RenderedImage.
+     * @param formatName
+     *            the format name.
+     * @param output
+     *            the output File where Image to be written.
      * @return true, if Image is written successfully, false otherwise.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
-    public static boolean write(RenderedImage im,
-                                String formatName,
-                                File output)
+    public static boolean write(RenderedImage im, String formatName, File output)
             throws IOException {
 
         if (output == null) {
@@ -553,20 +556,20 @@
     }
 
     /**
-     * Writes the specified image in the specified format (using an 
-     * appropriate ImageWriter) to the specified OutputStream.
+     * Writes the specified image in the specified format (using an appropriate
+     * ImageWriter) to the specified OutputStream.
      * 
-     * @param im the RenderedImage.
-     * @param formatName the format name.
-     * @param output the OutputStream where Image is to be written.
-     * 
+     * @param im
+     *            the RenderedImage.
+     * @param formatName
+     *            the format name.
+     * @param output
+     *            the OutputStream where Image is to be written.
      * @return true, if Image is written successfully, false otherwise.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
-    public static boolean write(RenderedImage im,
-                                String formatName,
-                                OutputStream output)
+    public static boolean write(RenderedImage im, String formatName, OutputStream output)
             throws IOException {
 
         if (output == null) {
@@ -579,26 +582,28 @@
         return rt;
     }
 
-
     /**
      * Filter to match spi by format name.
      */
     static class FormatFilter implements ServiceRegistry.Filter {
-        
-        /** The name. */
+
+        /**
+         * The name.
+         */
         private String name;
 
         /**
          * Instantiates a new format filter.
          * 
-         * @param name the name
+         * @param name
+         *            the name.
          */
         public FormatFilter(String name) {
             this.name = name;
         }
 
         public boolean filter(Object provider) {
-            ImageReaderWriterSpi spi = (ImageReaderWriterSpi) provider;
+            ImageReaderWriterSpi spi = (ImageReaderWriterSpi)provider;
             return Arrays.asList(spi.getFormatNames()).contains(name);
         }
     }
@@ -608,14 +613,18 @@
      */
     static class FormatAndEncodeFilter extends FormatFilter {
 
-        /** The type. */
+        /**
+         * The type.
+         */
         private ImageTypeSpecifier type;
 
         /**
          * Instantiates a new format and encode filter.
          * 
-         * @param type the type
-         * @param name the name
+         * @param type
+         *            the type.
+         * @param name
+         *            the name.
          */
         public FormatAndEncodeFilter(ImageTypeSpecifier type, String name) {
             super(name);
@@ -624,7 +633,7 @@
 
         @Override
         public boolean filter(Object provider) {
-            ImageWriterSpi spi = (ImageWriterSpi) provider;
+            ImageWriterSpi spi = (ImageWriterSpi)provider;
             return super.filter(provider) && spi.canEncodeImage(type);
         }
     }
@@ -633,21 +642,24 @@
      * Filter to match spi by suffix.
      */
     static class SuffixFilter implements ServiceRegistry.Filter {
-        
-        /** The suf. */
+
+        /**
+         * The suf.
+         */
         private String suf;
 
         /**
          * Instantiates a new suffix filter.
          * 
-         * @param suf the suf
+         * @param suf
+         *            the suf.
          */
         public SuffixFilter(String suf) {
             this.suf = suf;
         }
 
         public boolean filter(Object provider) {
-            ImageReaderWriterSpi spi = (ImageReaderWriterSpi) provider;
+            ImageReaderWriterSpi spi = (ImageReaderWriterSpi)provider;
             return Arrays.asList(spi.getFileSuffixes()).contains(suf);
         }
     }
@@ -656,21 +668,24 @@
      * Filter to match spi by decoding possibility.
      */
     static class CanReadFilter implements ServiceRegistry.Filter {
-        
-        /** The input. */
+
+        /**
+         * The input.
+         */
         private Object input;
 
         /**
          * Instantiates a new can read filter.
          * 
-         * @param input the input
+         * @param input
+         *            the input.
          */
         public CanReadFilter(Object input) {
             this.input = input;
         }
 
         public boolean filter(Object provider) {
-            ImageReaderSpi spi = (ImageReaderSpi) provider;
+            ImageReaderSpi spi = (ImageReaderSpi)provider;
             try {
                 return spi.canDecodeInput(input);
             } catch (IOException e) {
@@ -684,13 +699,16 @@
      */
     static class SpiIteratorToWritersIteratorWrapper implements Iterator<ImageWriter> {
 
-        /** The backend. */
+        /**
+         * The backend.
+         */
         private Iterator<ImageWriterSpi> backend;
 
         /**
          * Instantiates a new spi iterator to writers iterator wrapper.
          * 
-         * @param backend the backend
+         * @param backend
+         *            the backend.
          */
         public SpiIteratorToWritersIteratorWrapper(Iterator<ImageWriterSpi> backend) {
             this.backend = backend;
@@ -699,7 +717,7 @@
         /**
          * Next.
          * 
-         * @return the image writer
+         * @return the image writer.
          */
         public ImageWriter next() {
             try {
@@ -713,7 +731,7 @@
         /**
          * Checks for next.
          * 
-         * @return true, if successful
+         * @return true, if successful.
          */
         public boolean hasNext() {
             return backend.hasNext();
@@ -723,7 +741,8 @@
          * Removes the.
          */
         public void remove() {
-            throw new UnsupportedOperationException("Use deregisterServiceprovider instead of Iterator.remove()");
+            throw new UnsupportedOperationException(
+                    "Use deregisterServiceprovider instead of Iterator.remove()");
         }
     }
 
@@ -731,14 +750,17 @@
      * Wraps spi's iterator to ImageReader iterator.
      */
     static class SpiIteratorToReadersIteratorWrapper implements Iterator<ImageReader> {
-        
-        /** The backend. */
+
+        /**
+         * The backend.
+         */
         private Iterator<ImageReaderSpi> backend;
 
         /**
          * Instantiates a new spi iterator to readers iterator wrapper.
          * 
-         * @param backend the backend
+         * @param backend
+         *            the backend.
          */
         public SpiIteratorToReadersIteratorWrapper(Iterator<ImageReaderSpi> backend) {
             this.backend = backend;
@@ -747,7 +769,7 @@
         /**
          * Next.
          * 
-         * @return the image reader
+         * @return the image reader.
          */
         public ImageReader next() {
             try {
@@ -761,7 +783,7 @@
         /**
          * Checks for next.
          * 
-         * @return true, if successful
+         * @return true, if successful.
          */
         public boolean hasNext() {
             return backend.hasNext();
@@ -771,7 +793,8 @@
          * Removes the.
          */
         public void remove() {
-            throw new UnsupportedOperationException("Use deregisterServiceprovider instead of Iterator.remove()");
+            throw new UnsupportedOperationException(
+                    "Use deregisterServiceprovider instead of Iterator.remove()");
         }
     }
 }
diff --git a/awt/javax/imageio/ImageReadParam.java b/awt/javax/imageio/ImageReadParam.java
index e67ed7d..9cc5c5f 100644
--- a/awt/javax/imageio/ImageReadParam.java
+++ b/awt/javax/imageio/ImageReadParam.java
@@ -18,6 +18,7 @@
  * @author Sergey I. Salishev
  * @version $Revision: 1.2 $
  */
+
 package javax.imageio;
 
 import java.awt.Dimension;
@@ -29,45 +30,50 @@
  */
 
 /**
- * The ImageReadParam class provides information to the ImageReader about
- * how an image is to be decoded.
+ * The ImageReadParam class provides information to the ImageReader about how an
+ * image is to be decoded.
+ * 
+ * @since Android 1.0
  */
-
 public class ImageReadParam extends IIOParam {
 
-    /** 
-     * This flag indicates if this ImageReadParam supports setting the source 
-     * rendering size.  
+    /**
+     * This flag indicates if this ImageReadParam supports setting the source
+     * rendering size.
      */
     protected boolean canSetSourceRenderSize;
-    
-    /** 
-     * The destination BufferedImage. 
+
+    /**
+     * The destination BufferedImage.
      */
     protected BufferedImage destination;
-    
-    /** The destination bands. */
+
+    /**
+     * The destination bands.
+     */
     protected int[] destinationBands;
-    
-    /** 
-     * The minimum progressive pass.  
+
+    /**
+     * The minimum progressive pass.
      */
     protected int minProgressivePass;
-    
-    /** 
-     * The number of progressive passes.  
+
+    /**
+     * The number of progressive passes.
      */
     protected int numProgressivePasses;
-    
-    /** The source render size. */
+
+    /**
+     * The source render size.
+     */
     protected Dimension sourceRenderSize;
 
     /**
-     * Returns true if this ImageReaderParam supports rendering a
-     * source image at an arbitrary size.
+     * Returns true if this ImageReaderParam supports rendering a source image
+     * at an arbitrary size.
      * 
-     * @return true if this ImageReaderParam supports rendering a
-     * source image at an arbitrary size, false otherwise.
+     * @return true, if this ImageReaderParam supports rendering a source image
+     *         at an arbitrary size, false otherwise.
      */
     public boolean canSetSourceRenderSize() {
         return canSetSourceRenderSize;
@@ -92,11 +98,9 @@
     }
 
     /**
-     * Gets the index of the maximum pass to be decoded.
-     * This method returns Integer.MAX_VALUE, if 
-     * getSourceNumProgressivePasses() method returns value
-     * that is equal to Integer.MAX_VALUE. Otherwise
-     * this method returns 
+     * Gets the index of the maximum pass to be decoded. This method returns
+     * Integer.MAX_VALUE, if getSourceNumProgressivePasses() method returns
+     * value that is equal to Integer.MAX_VALUE. Otherwise this method returns
      * getSourceMinProgressivePass() + getSourceNumProgressivePasses() - 1.
      * 
      * @return the index of the maximum pass to be decoded.
@@ -109,19 +113,19 @@
     }
 
     /**
-     * Gets the index of the minimum progressive pass that is decoded,
-     * default is 0. 
+     * Gets the index of the minimum progressive pass that is decoded, default
+     * is 0.
      * 
      * @return the index of the minimum progressive pass that is decoded,
-     * default is 0.
+     *         default is 0.
      */
     public int getSourceMinProgressivePass() {
         return minProgressivePass;
     }
 
     /**
-     * Gets the number of progressive passes.
-     * The default value is Integer.MAX_VALUE. 
+     * Gets the number of progressive passes. The default value is
+     * Integer.MAX_VALUE.
      * 
      * @return the number of progressive passes.
      */
@@ -130,8 +134,8 @@
     }
 
     /**
-     * Gets the dimension of source image which will be rendered
-     * during decoding process.
+     * Gets the dimension of source image which will be rendered during decoding
+     * process.
      * 
      * @return the source render size.
      */
@@ -140,11 +144,12 @@
     }
 
     /**
-     * Sets the specified destination image.
-     * This image will be used by read, readAll, and readRaster methods,
-     * and a reference to it will be returned by those methods.
+     * Sets the specified destination image. This image will be used by read,
+     * readAll, and readRaster methods, and a reference to it will be returned
+     * by those methods.
      * 
-     * @param destination the destination image.
+     * @param destination
+     *            the destination image.
      */
     public void setDestination(BufferedImage destination) {
         this.destination = destination;
@@ -153,7 +158,8 @@
     /**
      * Sets the indices of the destination bands.
      * 
-     * @param destinationBands the indices of the destination bands.
+     * @param destinationBands
+     *            the indices of the destination bands.
      */
     public void setDestinationBands(int[] destinationBands) {
         this.destinationBands = destinationBands;
@@ -167,8 +173,10 @@
     /**
      * Sets the source progressive passes.
      * 
-     * @param minPass the index of the minimum pass to be decoded.
-     * @param numPasses the number of passes to be decoded.
+     * @param minPass
+     *            the index of the minimum pass to be decoded.
+     * @param numPasses
+     *            the number of passes to be decoded.
      */
     public void setSourceProgressivePasses(int minPass, int numPasses) {
         minProgressivePass = minPass;
@@ -176,18 +184,18 @@
     }
 
     /**
-     * Sets the dimension size of source image if an
-     * image can be rendered at an arbitrary size.
+     * Sets the dimension size of source image if an image can be rendered at an
+     * arbitrary size.
      * 
-     * @param size the size of rendered image.
-     * 
-     * @throws UnsupportedOperationException the unsupported operation exception
+     * @param size
+     *            the size of rendered image.
+     * @throws UnsupportedOperationException
+     *             the unsupported operation exception.
      */
     public void setSourceRenderSize(Dimension size) throws UnsupportedOperationException {
         if (!canSetSourceRenderSize) {
             throw new UnsupportedOperationException("can't set source renderer size");
         }
-        sourceRenderSize = size;        
+        sourceRenderSize = size;
     }
 }
-
diff --git a/awt/javax/imageio/ImageReader.java b/awt/javax/imageio/ImageReader.java
index 780de26..cf282ed 100644
--- a/awt/javax/imageio/ImageReader.java
+++ b/awt/javax/imageio/ImageReader.java
@@ -18,6 +18,7 @@
  * @author Rustem V. Rafikov
  * @version $Revision: 1.3 $
  */
+
 package javax.imageio;
 
 import javax.imageio.spi.ImageReaderSpi;
@@ -37,56 +38,77 @@
 import java.awt.*;
 
 /**
- * The ImageReader class is an abstract class for decoding images.
- * ImageReader objects are instantiated by the service provider 
- * interface, ImageReaderSpi class, for the specific format. 
- * ImageReaderSpi class should be registered with the IIORegistry, 
- * which uses them for format recognition and presentation of available 
- * format readers and writers.
+ * The ImageReader class is an abstract class for decoding images. ImageReader
+ * objects are instantiated by the service provider interface, ImageReaderSpi
+ * class, for the specific format. ImageReaderSpi class should be registered
+ * with the IIORegistry, which uses them for format recognition and presentation
+ * of available format readers and writers.
+ * 
+ * @since Android 1.0
  */
 public abstract class ImageReader {
 
-    /** The originating provider. */
+    /**
+     * The originating provider.
+     */
     protected ImageReaderSpi originatingProvider;
 
-    /** The input object such as ImageInputStream. */
+    /**
+     * The input object such as ImageInputStream.
+     */
     protected Object input;
 
-    /** The seek forward only. */
+    /**
+     * The seek forward only.
+     */
     protected boolean seekForwardOnly;
 
-    /** 
-     * The ignore metadata flag indicates whether current input source 
-     * has been marked as metadata is allowed to be ignored by setInput. 
+    /**
+     * The ignore metadata flag indicates whether current input source has been
+     * marked as metadata is allowed to be ignored by setInput.
      */
     protected boolean ignoreMetadata;
 
-    /** The minimum index. */
+    /**
+     * The minimum index.
+     */
     protected int minIndex;
 
-    /** The available locales. */
+    /**
+     * The available locales.
+     */
     protected Locale[] availableLocales;
 
-    /** The locale. */
+    /**
+     * The locale.
+     */
     protected Locale locale;
 
-    /** The list of warning listeners. */
+    /**
+     * The list of warning listeners.
+     */
     protected List<IIOReadWarningListener> warningListeners;
 
-    /** The list of warning locales. */
+    /**
+     * The list of warning locales.
+     */
     protected List<Locale> warningLocales;
 
-    /** The list of progress listeners. */
+    /**
+     * The list of progress listeners.
+     */
     protected List<IIOReadProgressListener> progressListeners;
 
-    /** The list of update listeners. */
+    /**
+     * The list of update listeners.
+     */
     protected List<IIOReadUpdateListener> updateListeners;
 
     /**
      * Instantiates a new ImageReader.
      * 
-     * @param originatingProvider the ImageReaderSpi which 
-     * instanties this ImageReader.
+     * @param originatingProvider
+     *            the ImageReaderSpi which instantiates this ImageReader.
      */
     protected ImageReader(ImageReaderSpi originatingProvider) {
         this.originatingProvider = originatingProvider;
@@ -96,15 +118,15 @@
      * Gets the format name of this input source.
      * 
      * @return the format name of this input source.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public String getFormatName() throws IOException {
         return originatingProvider.getFormatNames()[0];
     }
 
     /**
-     * Gets the ImageReaderSpi which instantiated this ImageReader. 
+     * Gets the ImageReaderSpi which instantiated this ImageReader.
      * 
      * @return the ImageReaderSpi.
      */
@@ -113,14 +135,17 @@
     }
 
     /**
-     * Sets the specified Object as the input source of this ImageReader. 
+     * Sets the specified Object as the input source of this ImageReader.
      * 
-     * @param input the input source, it can 
-     * be an ImageInputStream or other supported objects.
-     * @param seekForwardOnly indicates whether the stream must
-     * be read sequentially from its current starting point.
-     * @param ignoreMetadata parameter which indicates
-     * if metadata may be ignored during reads or not.
+     * @param input
+     *            the input source, it can be an ImageInputStream or other
+     *            supported objects.
+     * @param seekForwardOnly
+     *            indicates whether the stream must be read sequentially from
+     *            its current starting point.
+     * @param ignoreMetadata
+     *            parameter which indicates if metadata may be ignored during
+     *            reads or not.
      */
     public void setInput(Object input, boolean seekForwardOnly, boolean ignoreMetadata) {
         if (input != null) {
@@ -137,9 +162,9 @@
     /**
      * Checks if is supported.
      * 
-     * @param input the input
-     * 
-     * @return true, if is supported
+     * @param input
+     *            the input.
+     * @return true, if is supported.
      */
     private boolean isSupported(Object input) {
         ImageReaderSpi spi = getOriginatingProvider();
@@ -158,10 +183,12 @@
      * Sets the specified Object as the input source of this ImageReader.
      * Metadata is not ignored.
      * 
-     * @param input the input source, it can 
-     * be an ImageInputStream or other supported objects.
-     * @param seekForwardOnly indicates whether the stream must
-     * be read sequentially from its current starting point.
+     * @param input
+     *            the input source, it can be an ImageInputStream or other
+     *            supported objects.
+     * @param seekForwardOnly
+     *            indicates whether the stream must be read sequentially from
+     *            its current starting point.
      */
     public void setInput(Object input, boolean seekForwardOnly) {
         setInput(input, seekForwardOnly, false);
@@ -171,8 +198,8 @@
      * Sets the specified Object as the input source of this ImageReader.
      * Metadata is not ignored and forward seeking is not required.
      * 
-     * @param input the input source, it can 
-     * be ImageInputStream or other objects.
+     * @param input
+     *            the input source, it can be ImageInputStream or other objects.
      */
     public void setInput(Object input) {
         setInput(input, false, false);
@@ -181,8 +208,7 @@
     /**
      * Gets the input source object of this ImageReader, or returns null.
      * 
-     * @return the the input source object such as ImageInputStream,
-     * or null.
+     * @return the input source object such as ImageInputStream, or null.
      */
     public Object getInput() {
         return input;
@@ -191,32 +217,31 @@
     /**
      * Checks if the input source supports only forward reading, or not.
      * 
-     * @return true, if the input source supports only forward reading, 
-     * false otherwise.
+     * @return true, if the input source supports only forward reading, false
+     *         otherwise.
      */
     public boolean isSeekForwardOnly() {
         return seekForwardOnly;
     }
 
     /**
-     * Returns true if the current input source allows 
-     * to metadata to be ignored by passing true as 
-     * the ignoreMetadata argument to the setInput method.
+     * Returns true if the current input source allows to metadata to be ignored
+     * by passing true as the ignoreMetadata argument to the setInput method.
      * 
-     * @return true, if true if the current input source allows 
-     * to metadata to be ignored by passing true as 
-     * the ignoreMetadata argument to the setInput method.
+     * @return true, if the current input source allows to metadata to be
+     *         ignored by passing true as the ignoreMetadata argument to the
+     *         setInput method.
      */
     public boolean isIgnoringMetadata() {
         return ignoreMetadata;
     }
 
     /**
-     * Gets the minimum valid index for reading an image, thumbnail, 
-     * or image metadata. 
+     * Gets the minimum valid index for reading an image, thumbnail, or image
+     * metadata.
      * 
-     * @return the minimum valid index for reading an image, thumbnail, 
-     * or image metadata.
+     * @return the minimum valid index for reading an image, thumbnail, or image
+     *         metadata.
      */
     public int getMinIndex() {
         return minIndex;
@@ -234,7 +259,8 @@
     /**
      * Sets the locale to this ImageReader.
      * 
-     * @param locale the Locale.
+     * @param locale
+     *            the Locale.
      */
     public void setLocale(Locale locale) {
         throw new UnsupportedOperationException("Not implemented yet");
@@ -252,89 +278,88 @@
     /**
      * Gets the number of images available in the current input source.
      * 
-     * @param allowSearch the parameter which indicates what
-     * a search is required; if false, the reader may return -1  
-     * without searching.
-     * 
+     * @param allowSearch
+     *            the parameter which indicates what a search is required; if
+     *            false, the reader may return -1 without searching.
      * @return the number of images.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public abstract int getNumImages(boolean allowSearch) throws IOException;
 
     /**
      * Gets the width of the specified image in input source.
      * 
-     * @param imageIndex the image index.
-     * 
+     * @param imageIndex
+     *            the image index.
      * @return the width in pixels.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public abstract int getWidth(int imageIndex) throws IOException;
 
     /**
      * Gets the height of the specified image in input source.
      * 
-     * @param imageIndex the image index.
-     * 
+     * @param imageIndex
+     *            the image index.
      * @return the height in pixels.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public abstract int getHeight(int imageIndex) throws IOException;
 
     /**
-     * Checks if the storage format of the specified image places 
-     * an impediment on random pixels access or not. 
+     * Checks if the storage format of the specified image places an impediment
+     * on random pixels access or not.
      * 
-     * @param imageIndex the image's index.
-     * 
-     * @return true, if the storage format of the specified image places 
-     * an impediment on random pixels access, false otherwise.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param imageIndex
+     *            the image's index.
+     * @return true, if the storage format of the specified image places an
+     *         impediment on random pixels access, false otherwise.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public boolean isRandomAccessEasy(int imageIndex) throws IOException {
-        return false; //def
+        return false; // def
     }
 
     /**
      * Gets the aspect ratio (width devided by height) of the image.
      * 
-     * @param imageIndex the image index.
-     * 
+     * @param imageIndex
+     *            the image index.
      * @return the aspect ratio of the image.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public float getAspectRatio(int imageIndex) throws IOException {
-        return (float) getWidth(imageIndex) / getHeight(imageIndex);
+        return (float)getWidth(imageIndex) / getHeight(imageIndex);
     }
 
     /**
-     * Gets an ImageTypeSpecifier which indicates the type of the 
-     * specified image.
+     * Gets an ImageTypeSpecifier which indicates the type of the specified
+     * image.
      * 
-     * @param imageIndex the image's index.
-     * 
+     * @param imageIndex
+     *            the image's index.
      * @return the ImageTypeSpecifier.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public ImageTypeSpecifier getRawImageType(int imageIndex) throws IOException {
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     /**
-     * Gets an Iterator of ImageTypeSpecifier objects which are associated
-     * with image types that may be used when decoding specified image.
+     * Gets an Iterator of ImageTypeSpecifier objects which are associated with
+     * image types that may be used when decoding specified image.
      * 
-     * @param imageIndex the image index.
-     * 
+     * @param imageIndex
+     *            the image index.
      * @return an Iterator of ImageTypeSpecifier objects.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public abstract Iterator<ImageTypeSpecifier> getImageTypes(int imageIndex) throws IOException;
 
@@ -351,21 +376,22 @@
      * Gets an IIOMetadata object for this input source.
      * 
      * @return the IIOMetadata.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public abstract IIOMetadata getStreamMetadata() throws IOException;
 
     /**
      * Gets an IIOMetadata object for this input source.
      * 
-     * @param formatName the desired metadata format to be used in the 
-     * returned IIOMetadata object.
-     * @param nodeNames the node names of the document.
-     * 
+     * @param formatName
+     *            the desired metadata format to be used in the returned
+     *            IIOMetadata object.
+     * @param nodeNames
+     *            the node names of the document.
      * @return the IIOMetadata.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public IIOMetadata getStreamMetadata(String formatName, Set<String> nodeNames)
             throws IOException {
@@ -375,83 +401,86 @@
     /**
      * Gets the image metadata of the specified image in input source.
      * 
-     * @param imageIndex the image index.
-     * 
+     * @param imageIndex
+     *            the image index.
      * @return the IIOMetadata.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public abstract IIOMetadata getImageMetadata(int imageIndex) throws IOException;
 
     /**
      * Gets the image metadata of the specified image input source.
      * 
-     * @param imageIndex the image index.
-     * @param formatName the desired metadata format to be used in the 
-     * returned IIOMetadata object.
-     * @param nodeNames the node names which can be contained in
-     * the document.
-     * 
+     * @param imageIndex
+     *            the image index.
+     * @param formatName
+     *            the desired metadata format to be used in the returned
+     *            IIOMetadata object.
+     * @param nodeNames
+     *            the node names which can be contained in the document.
      * @return the IIOMetadata.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
-    public IIOMetadata getImageMetadata(int imageIndex, String formatName,
-                                        Set<String> nodeNames) throws IOException {
+    public IIOMetadata getImageMetadata(int imageIndex, String formatName, Set<String> nodeNames)
+            throws IOException {
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     /**
-     * Reads the specified image and returns it as a BufferedImage
-     * using the default ImageReadParam.
-     *  
-     * @param imageIndex the image index.
+     * Reads the specified image and returns it as a BufferedImage using the
+     * default ImageReadParam.
      * 
+     * @param imageIndex
+     *            the image index.
      * @return the BufferedImage.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public BufferedImage read(int imageIndex) throws IOException {
         return read(imageIndex, null);
     }
 
     /**
-     * Reads the specified image and returns it as a BufferedImage
-     * using the specified ImageReadParam.
+     * Reads the specified image and returns it as a BufferedImage using the
+     * specified ImageReadParam.
      * 
-     * @param imageIndex the image index.
-     * @param param the ImageReadParam.
-     * 
+     * @param imageIndex
+     *            the image index.
+     * @param param
+     *            the ImageReadParam.
      * @return the BufferedImage.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public abstract BufferedImage read(int imageIndex, ImageReadParam param) throws IOException;
 
     /**
      * Reads the specified image and returns an IIOImage with this image,
-     * thumbnails, and metadata for this image, using 
-     * the specified ImageReadParam.
+     * thumbnails, and metadata for this image, using the specified
+     * ImageReadParam.
      * 
-     * @param imageIndex the image index.
-     * @param param the ImageReadParam.
-     * 
+     * @param imageIndex
+     *            the image index.
+     * @param param
+     *            the ImageReadParam.
      * @return the IIOImage.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public IIOImage readAll(int imageIndex, ImageReadParam param) throws IOException {
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     /**
-     * Returns an Iterator of IIOImages from the input source. 
+     * Returns an Iterator of IIOImages from the input source.
      * 
-     * @param params the Iterator of ImageReadParam objects.
-     * 
+     * @param params
+     *            the Iterator of ImageReadParam objects.
      * @return the iterator of IIOImages.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public Iterator<IIOImage> readAll(Iterator<? extends ImageReadParam> params) throws IOException {
         throw new UnsupportedOperationException("Not implemented yet");
@@ -460,23 +489,23 @@
     /**
      * Checks whether or not this plug-in supports reading a Raster.
      * 
-     * @return true, if this plug-in supports reading a Raster,
-     * false otherwise.
+     * @return true, if this plug-in supports reading a Raster, false otherwise.
      */
     public boolean canReadRaster() {
-        return false; //def
+        return false; // def
     }
 
     /**
-     * Reads a new Raster object which contains the raw pixel data from 
-     * the image. 
+     * Reads a new Raster object which contains the raw pixel data from the
+     * image.
      * 
-     * @param imageIndex the image index.
-     * @param param the ImageReadParam.
-     * 
+     * @param imageIndex
+     *            the image index.
+     * @param param
+     *            the ImageReadParam.
      * @return the Raster.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public Raster readRaster(int imageIndex, ImageReadParam param) throws IOException {
         throw new UnsupportedOperationException("Unsupported");
@@ -485,220 +514,226 @@
     /**
      * Checks if the specified image has tiles or not.
      * 
-     * @param imageIndex the image's index.
-     * 
-     * @return true, if the specified image has tiles,
-     * false otherwise.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param imageIndex
+     *            the image's index.
+     * @return true, if the specified image has tiles, false otherwise.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public boolean isImageTiled(int imageIndex) throws IOException {
-        return false; //def
+        return false; // def
     }
 
     /**
      * Gets the tile width in the specified image.
      * 
-     * @param imageIndex the image's index.
-     * 
+     * @param imageIndex
+     *            the image's index.
      * @return the tile width.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public int getTileWidth(int imageIndex) throws IOException {
-        return getWidth(imageIndex); //def
+        return getWidth(imageIndex); // def
     }
 
     /**
      * Gets the tile height in the specified image.
      * 
-     * @param imageIndex the image's index.
-     * 
+     * @param imageIndex
+     *            the image's index.
      * @return the tile height.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public int getTileHeight(int imageIndex) throws IOException {
-        return getHeight(imageIndex); //def
+        return getHeight(imageIndex); // def
     }
 
     /**
-     * Gets the X coordinate of the upper left corner of the tile grid in the 
+     * Gets the X coordinate of the upper left corner of the tile grid in the
      * specified image.
      * 
-     * @param imageIndex the image's index.
-     * 
+     * @param imageIndex
+     *            the image's index.
      * @return the X coordinate of the upper left corner of the tile grid.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public int getTileGridXOffset(int imageIndex) throws IOException {
-        return 0; //def
+        return 0; // def
     }
 
     /**
-     * Gets the Y coordinate of the upper left corner of the tile grid in the 
+     * Gets the Y coordinate of the upper left corner of the tile grid in the
      * specified image.
      * 
-     * @param imageIndex the image's index.
-     * 
+     * @param imageIndex
+     *            the image's index.
      * @return the Y coordinate of the upper left corner of the tile grid.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public int getTileGridYOffset(int imageIndex) throws IOException {
-        return 0; //def
+        return 0; // def
     }
 
     /**
-     * Reads the tile specified by the tileX and tileY parameters
-     * of the specified image and returns it as a BufferedImage. 
+     * Reads the tile specified by the tileX and tileY parameters of the
+     * specified image and returns it as a BufferedImage.
      * 
-     * @param imageIndex the image index.
-     * @param tileX the X index of tile.
-     * @param tileY the Y index of tile.
-     * 
+     * @param imageIndex
+     *            the image index.
+     * @param tileX
+     *            the X index of tile.
+     * @param tileY
+     *            the Y index of tile.
      * @return the BufferedImage.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public BufferedImage readTile(int imageIndex, int tileX, int tileY) throws IOException {
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     /**
-     * Reads the tile specified by the tileX and tileY parameters
-     * of the specified image and returns it as a Raster. 
+     * Reads the tile specified by the tileX and tileY parameters of the
+     * specified image and returns it as a Raster.
      * 
-     * @param imageIndex the image index.
-     * @param tileX the X index of tile.
-     * @param tileY the Y index of tile.
-     * 
+     * @param imageIndex
+     *            the image index.
+     * @param tileX
+     *            the X index of tile.
+     * @param tileY
+     *            the Y index of tile.
      * @return the Raster.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public Raster readTileRaster(int imageIndex, int tileX, int tileY) throws IOException {
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     /**
-     * Reads the specified image using the specified 
-     * ImageReadParam and returns it as a RenderedImage.
+     * Reads the specified image using the specified ImageReadParam and returns
+     * it as a RenderedImage.
      * 
-     * @param imageIndex the image index.
-     * @param param the ImageReadParam.
-     * 
+     * @param imageIndex
+     *            the image index.
+     * @param param
+     *            the ImageReadParam.
      * @return the RenderedImage.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
-    public RenderedImage readAsRenderedImage(int imageIndex, ImageReadParam param) throws IOException {
+    public RenderedImage readAsRenderedImage(int imageIndex, ImageReadParam param)
+            throws IOException {
         return read(imageIndex, param);
     }
 
     /**
-     * Returns true if the image format supported by this reader 
-     * supports thumbnail preview images.
+     * Returns true if the image format supported by this reader supports
+     * thumbnail preview images.
      * 
-     * @return true if the image format supported by this reader 
-     * supports thumbnail preview images, false otherwise.
+     * @return true, if the image format supported by this reader supports
+     *         thumbnail preview images, false otherwise.
      */
     public boolean readerSupportsThumbnails() {
-        return false; //def
+        return false; // def
     }
 
     /**
      * Checks if the specified image has thumbnails or not.
      * 
-     * @param imageIndex the image's index.
-     * 
-     * @return true, if the specified image has thumbnails,
-     * false otherwise.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param imageIndex
+     *            the image's index.
+     * @return true, if the specified image has thumbnails, false otherwise.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public boolean hasThumbnails(int imageIndex) throws IOException {
-        return getNumThumbnails(imageIndex) > 0; //def
+        return getNumThumbnails(imageIndex) > 0; // def
     }
 
     /**
      * Gets the number of thumbnails for the specified image.
      * 
-     * @param imageIndex the image's index.
-     * 
+     * @param imageIndex
+     *            the image's index.
      * @return the number of thumbnails.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public int getNumThumbnails(int imageIndex) throws IOException {
-        return 0; //def
+        return 0; // def
     }
 
     /**
      * Gets the width of the specified thumbnail for the specified image.
      * 
-     * @param imageIndex the image's index.
-     * @param thumbnailIndex the thumbnail's index.
-     * 
+     * @param imageIndex
+     *            the image's index.
+     * @param thumbnailIndex
+     *            the thumbnail's index.
      * @return the thumbnail width.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public int getThumbnailWidth(int imageIndex, int thumbnailIndex) throws IOException {
-        return readThumbnail(imageIndex, thumbnailIndex).getWidth();  //def
+        return readThumbnail(imageIndex, thumbnailIndex).getWidth(); // def
     }
 
     /**
      * Gets the height of the specified thumbnail for the specified image.
      * 
-     * @param imageIndex the image's index.
-     * @param thumbnailIndex the thumbnail's index.
-     * 
+     * @param imageIndex
+     *            the image's index.
+     * @param thumbnailIndex
+     *            the thumbnail's index.
      * @return the thumbnail height.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public int getThumbnailHeight(int imageIndex, int thumbnailIndex) throws IOException {
-        return readThumbnail(imageIndex, thumbnailIndex).getHeight();  //def
+        return readThumbnail(imageIndex, thumbnailIndex).getHeight(); // def
     }
 
     /**
-     * Reads the thumbnail image for the specified image
-     * as a BufferedImage.
-     *  
-     * @param imageIndex the image index.
-     * @param thumbnailIndex the thumbnail index.
+     * Reads the thumbnail image for the specified image as a BufferedImage.
      * 
+     * @param imageIndex
+     *            the image index.
+     * @param thumbnailIndex
+     *            the thumbnail index.
      * @return the BufferedImage.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public BufferedImage readThumbnail(int imageIndex, int thumbnailIndex) throws IOException {
-        throw new UnsupportedOperationException("Unsupported"); //def
+        throw new UnsupportedOperationException("Unsupported"); // def
     }
 
     /**
-     * Requests an abort operation for current reading operation. 
+     * Requests an abort operation for current reading operation.
      */
     public void abort() {
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     /**
-     * Checks whether or not a request to abort the current read operation 
-     * has been made successfully.
+     * Checks whether or not a request to abort the current read operation has
+     * been made successfully.
      * 
-     * @return true, if the request to abort the current read operation 
-     * has been made successfully, false otherwise.
+     * @return true, if the request to abort the current read operation has been
+     *         made successfully, false otherwise.
      */
     protected boolean abortRequested() {
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     /**
-     * Clears all previous abort request, and abortRequested returns false
-     * after calling this method.
+     * Clears all previous abort request, and abortRequested returns false after
+     * calling this method.
      */
     protected void clearAbortRequest() {
         throw new UnsupportedOperationException("Not implemented yet");
@@ -707,7 +742,8 @@
     /**
      * Adds the IIOReadWarningListener.
      * 
-     * @param listener the IIOReadWarningListener.
+     * @param listener
+     *            the IIOReadWarningListener.
      */
     public void addIIOReadWarningListener(IIOReadWarningListener listener) {
         throw new UnsupportedOperationException("Not implemented yet");
@@ -716,7 +752,8 @@
     /**
      * Removes the specified IIOReadWarningListener.
      * 
-     * @param listener the IIOReadWarningListener to be removed.
+     * @param listener
+     *            the IIOReadWarningListener to be removed.
      */
     public void removeIIOReadWarningListener(IIOReadWarningListener listener) {
         throw new UnsupportedOperationException("Not implemented yet");
@@ -732,7 +769,8 @@
     /**
      * Adds the IIOReadProgressListener.
      * 
-     * @param listener the IIOReadProgressListener.
+     * @param listener
+     *            the IIOReadProgressListener.
      */
     public void addIIOReadProgressListener(IIOReadProgressListener listener) {
         throw new UnsupportedOperationException("Not implemented yet");
@@ -741,7 +779,8 @@
     /**
      * Removes the specified IIOReadProgressListener.
      * 
-     * @param listener the IIOReadProgressListener to be removed.
+     * @param listener
+     *            the IIOReadProgressListener to be removed.
      */
     public void removeIIOReadProgressListener(IIOReadProgressListener listener) {
         throw new UnsupportedOperationException("Not implemented yet");
@@ -757,7 +796,8 @@
     /**
      * Adds the IIOReadUpdateListener.
      * 
-     * @param listener the IIOReadUpdateListener.
+     * @param listener
+     *            the IIOReadUpdateListener.
      */
     public void addIIOReadUpdateListener(IIOReadUpdateListener listener) {
         throw new UnsupportedOperationException("Not implemented yet");
@@ -766,7 +806,8 @@
     /**
      * Removes the specified IIOReadUpdateListener.
      * 
-     * @param listener the IIOReadUpdateListener to be removed.
+     * @param listener
+     *            the IIOReadUpdateListener to be removed.
      */
     public void removeIIOReadUpdateListener(IIOReadUpdateListener listener) {
         throw new UnsupportedOperationException("Not implemented yet");
@@ -780,229 +821,243 @@
     }
 
     /**
-     * Processes the start of an sequence of image reads
-     * by calling the sequenceStarted method on all registered 
-     * IIOReadProgressListeners. 
+     * Processes the start of an sequence of image reads by calling the
+     * sequenceStarted method on all registered IIOReadProgressListeners.
      * 
-     * @param minIndex the minimum index.
+     * @param minIndex
+     *            the minimum index.
      */
     protected void processSequenceStarted(int minIndex) {
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     /**
-     * Processes the completion of an sequence of image reads
-     * by calling sequenceComplete method on all registered 
-     * IIOReadProgressListeners. 
+     * Processes the completion of an sequence of image reads by calling
+     * sequenceComplete method on all registered IIOReadProgressListeners.
      */
     protected void processSequenceComplete() {
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     /**
-     * Processes the start of an image read by calling the imageStarted
-     * method on all registered IIOReadProgressListeners.
+     * Processes the start of an image read by calling the imageStarted method
+     * on all registered IIOReadProgressListeners.
      * 
-     * @param imageIndex the image index.
+     * @param imageIndex
+     *            the image index.
      */
     protected void processImageStarted(int imageIndex) {
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     /**
-     * Processes the current percentage of image completion by calling 
-     * the imageProgress method on all registered IIOReadProgressListeners.
+     * Processes the current percentage of image completion by calling the
+     * imageProgress method on all registered IIOReadProgressListeners.
      * 
-     * @param percentageDone the percentage done.
+     * @param percentageDone
+     *            the percentage done.
      */
     protected void processImageProgress(float percentageDone) {
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     /**
-     * Processes image completion by calling the imageComplete method
-     * on all registered IIOReadProgressListeners. 
+     * Processes image completion by calling the imageComplete method on all
+     * registered IIOReadProgressListeners.
      */
     protected void processImageComplete() {
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     /**
-     * Processes the start of a thumbnail read by calling the
-     * thumbnailStarted method on all registered IIOReadProgressListeners. 
+     * Processes the start of a thumbnail read by calling the thumbnailStarted
+     * method on all registered IIOReadProgressListeners.
      * 
-     * @param imageIndex the image index.
-     * @param thumbnailIndex the thumbnail index.
+     * @param imageIndex
+     *            the image index.
+     * @param thumbnailIndex
+     *            the thumbnail index.
      */
     protected void processThumbnailStarted(int imageIndex, int thumbnailIndex) {
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     /**
-     * Processes the current percentage of thumbnail completion 
-     * by calling the thumbnailProgress method on all registered 
-     * IIOReadProgressListeners.
+     * Processes the current percentage of thumbnail completion by calling the
+     * thumbnailProgress method on all registered IIOReadProgressListeners.
      * 
-     * @param percentageDone the percentage done.
+     * @param percentageDone
+     *            the percentage done.
      */
     protected void processThumbnailProgress(float percentageDone) {
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     /**
-     * Processes the completion of a thumbnail read 
-     * by calling the thumbnailComplete method 
-     * on all registered IIOReadProgressListeners. 
+     * Processes the completion of a thumbnail read by calling the
+     * thumbnailComplete method on all registered IIOReadProgressListeners.
      */
     protected void processThumbnailComplete() {
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     /**
-     * Processes a read aborted event by calling the readAborted 
-     * method on all registered IIOReadProgressListeners.
+     * Processes a read aborted event by calling the readAborted method on all
+     * registered IIOReadProgressListeners.
      */
     protected void processReadAborted() {
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     /**
-     * Processes the beginning of a progressive pass by calling 
-     * the passStarted method on all registered IIOReadUpdateListeners.
+     * Processes the beginning of a progressive pass by calling the passStarted
+     * method on all registered IIOReadUpdateListeners.
      * 
-     * @param theImage the image to be updated.
-     * @param pass the current pass index.
-     * @param minPass the minimum pass index.
-     * @param maxPass the maximum pass index.
-     * @param minX the X coordinate of of the upper left pixel. 
-     * @param minY the Y coordinate of of the upper left pixel.
-     * @param periodX the horizontal separation between pixels.
-     * @param periodY the vertical separation between pixels.
-     * @param bands the number of affected bands.
+     * @param theImage
+     *            the image to be updated.
+     * @param pass
+     *            the current pass index.
+     * @param minPass
+     *            the minimum pass index.
+     * @param maxPass
+     *            the maximum pass index.
+     * @param minX
+     *            the X coordinate of of the upper left pixel.
+     * @param minY
+     *            the Y coordinate of of the upper left pixel.
+     * @param periodX
+     *            the horizontal separation between pixels.
+     * @param periodY
+     *            the vertical separation between pixels.
+     * @param bands
+     *            the number of affected bands.
      */
-    protected void processPassStarted(BufferedImage theImage,
-                                  int pass,
-                                  int minPass,
-                                  int maxPass,
-                                  int minX,
-                                  int minY,
-                                  int periodX,
-                                  int periodY,
-                                  int[] bands) {
+    protected void processPassStarted(BufferedImage theImage, int pass, int minPass, int maxPass,
+            int minX, int minY, int periodX, int periodY, int[] bands) {
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     /**
-     * Processes the update of a set of samples by calling 
-     * the imageUpdate method on all registered IIOReadUpdateListeners.  
+     * Processes the update of a set of samples by calling the imageUpdate
+     * method on all registered IIOReadUpdateListeners.
      * 
-     * @param theImage the image to be updated.
-     * @param minX the X coordinate of the upper left pixel.
-     * @param minY the Y coordinate of the upper left pixel.
-     * @param width the width of updated area.
-     * @param height the height of updated area.
-     * @param periodX the horizontal separation between pixels.
-     * @param periodY the vertical separation between pixels.
-     * @param bands the number of affected bands.
+     * @param theImage
+     *            the image to be updated.
+     * @param minX
+     *            the X coordinate of the upper left pixel.
+     * @param minY
+     *            the Y coordinate of the upper left pixel.
+     * @param width
+     *            the width of updated area.
+     * @param height
+     *            the height of updated area.
+     * @param periodX
+     *            the horizontal separation between pixels.
+     * @param periodY
+     *            the vertical separation between pixels.
+     * @param bands
+     *            the number of affected bands.
      */
-    protected void processImageUpdate(BufferedImage theImage,
-                                  int minX,
-                                  int minY,
-                                  int width,
-                                  int height,
-                                  int periodX,
-                                  int periodY,
-                                  int[] bands) {
+    protected void processImageUpdate(BufferedImage theImage, int minX, int minY, int width,
+            int height, int periodX, int periodY, int[] bands) {
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     /**
-     * Processes the end of a progressive pass by calling passComplete
-     * method of registered IIOReadUpdateListeners.
+     * Processes the end of a progressive pass by calling passComplete method of
+     * registered IIOReadUpdateListeners.
      * 
-     * @param theImage the image to be updated.
+     * @param theImage
+     *            the image to be updated.
      */
     protected void processPassComplete(BufferedImage theImage) {
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     /**
-     * Processes the beginning of a thumbnail progressive pass
-     * by calling the thumbnailPassStarted method on all 
-     * registered IIOReadUpdateListeners.
+     * Processes the beginning of a thumbnail progressive pass by calling the
+     * thumbnailPassStarted method on all registered IIOReadUpdateListeners.
      * 
-     * @param theThumbnail the the thumbnail to be updated.
-     * @param pass the current pass index.
-     * @param minPass the minimum pass index.
-     * @param maxPass the maximum pass index.
-     * @param minX the X coordinate of the upper left pixel. 
-     * @param minY the Y coordinate of the upper left pixel.
-     * @param periodX the horizontal separation between pixels.
-     * @param periodY the vertical separation between pixels.
-     * @param bands the number of affected bands.
+     * @param theThumbnail
+     *            the thumbnail to be updated.
+     * @param pass
+     *            the current pass index.
+     * @param minPass
+     *            the minimum pass index.
+     * @param maxPass
+     *            the maximum pass index.
+     * @param minX
+     *            the X coordinate of the upper left pixel.
+     * @param minY
+     *            the Y coordinate of the upper left pixel.
+     * @param periodX
+     *            the horizontal separation between pixels.
+     * @param periodY
+     *            the vertical separation between pixels.
+     * @param bands
+     *            the number of affected bands.
      */
-    protected void processThumbnailPassStarted(BufferedImage theThumbnail,
-                                           int pass,
-                                           int minPass,
-                                           int maxPass,
-                                           int minX,
-                                           int minY,
-                                           int periodX,
-                                           int periodY,
-                                           int[] bands) {
+    protected void processThumbnailPassStarted(BufferedImage theThumbnail, int pass, int minPass,
+            int maxPass, int minX, int minY, int periodX, int periodY, int[] bands) {
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     /**
-     * Processes the update of a set of samples in a thumbnail 
-     * image by calling the thumbnailUpdate method on all
-     * registered IIOReadUpdateListeners. 
+     * Processes the update of a set of samples in a thumbnail image by calling
+     * the thumbnailUpdate method on all registered IIOReadUpdateListeners.
      * 
-     * @param theThumbnail the the thumbnail to be updated.
-     * @param minX the X coordinate of the upper left pixel. 
-     * @param minY the Y coordinate of the upper left pixel.
-     * @param periodX the horizontal separation between pixels.
-     * @param periodY the vertical separation between pixels.
-     * @param bands the number of affected bands.
+     * @param theThumbnail
+     *            the thumbnail to be updated.
+     * @param minX
+     *            the X coordinate of the upper left pixel.
+     * @param minY
+     *            the Y coordinate of the upper left pixel.
+     * @param width
+     *            the total width of the updated area.
+     * @param height
+     *            the total height of the updated area.
+     * @param periodX
+     *            the horizontal separation between pixels.
+     * @param periodY
+     *            the vertical separation between pixels.
+     * @param bands
+     *            the number of affected bands.
      */
-    protected void processThumbnailUpdate(BufferedImage theThumbnail,
-                                      int minX,
-                                      int minY,
-                                      int width,
-                                      int height,
-                                      int periodX,
-                                      int periodY,
-                                       int[] bands) {
+    protected void processThumbnailUpdate(BufferedImage theThumbnail, int minX, int minY,
+            int width, int height, int periodX, int periodY, int[] bands) {
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     /**
-     * Processes the end of a thumbnail progressive pass 
-     * by calling the thumbnailPassComplete method
-     * on all registered IIOReadUpdateListeners. 
+     * Processes the end of a thumbnail progressive pass by calling the
+     * thumbnailPassComplete method on all registered IIOReadUpdateListeners.
      * 
-     * @param theThumbnail the thumbnail to be updated.
+     * @param theThumbnail
+     *            the thumbnail to be updated.
      */
     protected void processThumbnailPassComplete(BufferedImage theThumbnail) {
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     /**
-     * Processes a warning message by calling warningOccurred method
-     * of registered IIOReadWarningListeners.
+     * Processes a warning message by calling warningOccurred method of
+     * registered IIOReadWarningListeners.
      * 
-     * @param warning the warning.
+     * @param warning
+     *            the warning.
      */
     protected void processWarningOccurred(String warning) {
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     /**
-     * Processes a warning by calling the warningOccurred method 
-     * of on all registered IIOReadWarningListeners.
+     * Processes a warning by calling the warningOccurred method of on all
+     * registered IIOReadWarningListeners.
      * 
-     * @param baseName the base name of ResourceBundles.
-     * @param keyword the keyword to index the warning among ResourceBundles.
+     * @param baseName
+     *            the base name of ResourceBundles.
+     * @param keyword
+     *            the keyword to index the warning among ResourceBundles.
      */
     protected void processWarningOccurred(String baseName, String keyword) {
         throw new UnsupportedOperationException("Not implemented yet");
@@ -1029,13 +1084,15 @@
     }
 
     /**
-     * Gets the region of source image that should be read with the 
-     * specified width, height and ImageReadParam. 
+     * Gets the region of source image that should be read with the specified
+     * width, height and ImageReadParam.
      * 
-     * @param param the ImageReadParam object, or null.
-     * @param srcWidth the source image's width.
-     * @param srcHeight the source image's  height.
-     * 
+     * @param param
+     *            the ImageReadParam object, or null.
+     * @param srcWidth
+     *            the source image's width.
+     * @param srcHeight
+     *            the source image's height.
      * @return the Rectangle of source region.
      */
     protected static Rectangle getSourceRegion(ImageReadParam param, int srcWidth, int srcHeight) {
@@ -1043,58 +1100,63 @@
     }
 
     /**
-     * Computes the specified source region and the specified destination 
-     * region with the specified the width and height of the source image,
-     * an optional destination image, and an ImageReadParam. 
+     * Computes the specified source region and the specified destination region
+     * with the specified the width and height of the source image, an optional
+     * destination image, and an ImageReadParam.
      * 
-     * @param param the an ImageReadParam object, or null.
-     * @param srcWidth the source image's width.
-     * @param srcHeight the source image's height.
-     * @param image the destination image.
-     * @param srcRegion the source region.
-     * @param destRegion the destination region.
+     * @param param
+     *            the an ImageReadParam object, or null.
+     * @param srcWidth
+     *            the source image's width.
+     * @param srcHeight
+     *            the source image's height.
+     * @param image
+     *            the destination image.
+     * @param srcRegion
+     *            the source region.
+     * @param destRegion
+     *            the destination region.
      */
-    protected static void computeRegions(ImageReadParam param,
-                                     int srcWidth,
-                                     int srcHeight,
-                                     BufferedImage image,
-                                     Rectangle srcRegion,
-                                     Rectangle destRegion) {
+    protected static void computeRegions(ImageReadParam param, int srcWidth, int srcHeight,
+            BufferedImage image, Rectangle srcRegion, Rectangle destRegion) {
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     /**
-     * Checks the validity of the source and destination band and is called
-     * when the reader knows the number of bands of the source image and 
-     * the number of bands of the destination image. 
+     * Checks the validity of the source and destination band and is called when
+     * the reader knows the number of bands of the source image and the number
+     * of bands of the destination image.
      * 
-     * @param param the ImageReadParam for reading the Image.
-     * @param numSrcBands the number of bands in the source.
-     * @param numDstBands the number of bands in the destination.
+     * @param param
+     *            the ImageReadParam for reading the Image.
+     * @param numSrcBands
+     *            the number of bands in the source.
+     * @param numDstBands
+     *            the number of bands in the destination.
      */
-    protected static void checkReadParamBandSettings(ImageReadParam param,
-                                                 int numSrcBands,
-                                                 int numDstBands) {
+    protected static void checkReadParamBandSettings(ImageReadParam param, int numSrcBands,
+            int numDstBands) {
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     /**
-     * Gets the destination image where the decoded data is written. 
+     * Gets the destination image where the decoded data is written.
      * 
-     * @param param the ImageReadParam.
-     * @param imageTypes the iterator of ImageTypeSpecifier objects.
-     * @param width the width of the image being decoded.
-     * @param height the height of the image being decoded.
-     * 
+     * @param param
+     *            the ImageReadParam.
+     * @param imageTypes
+     *            the iterator of ImageTypeSpecifier objects.
+     * @param width
+     *            the width of the image being decoded.
+     * @param height
+     *            the height of the image being decoded.
      * @return the BufferedImage where decoded pixels should be written.
-     * 
-     * @throws IIOException the IIOException is thrown if 
-     * there is no suitable ImageTypeSpecifier.
+     * @throws IIOException
+     *             the IIOException is thrown if there is no suitable
+     *             ImageTypeSpecifier.
      */
-    protected static BufferedImage getDestination(ImageReadParam param, Iterator<ImageTypeSpecifier> imageTypes,
-                                              int width,
-                                              int height)
-                                       throws IIOException {
+    protected static BufferedImage getDestination(ImageReadParam param,
+            Iterator<ImageTypeSpecifier> imageTypes, int width, int height) throws IIOException {
         throw new UnsupportedOperationException("Not implemented yet");
     }
 }
diff --git a/awt/javax/imageio/ImageTranscoder.java b/awt/javax/imageio/ImageTranscoder.java
index 1a0de76..632d890 100644
--- a/awt/javax/imageio/ImageTranscoder.java
+++ b/awt/javax/imageio/ImageTranscoder.java
@@ -18,43 +18,50 @@
  * @author Rustem V. Rafikov
  * @version $Revision: 1.3 $
  */
+
 package javax.imageio;
 
 import javax.imageio.metadata.IIOMetadata;
 import javax.imageio.ImageTypeSpecifier;
 
 /**
- * The ImageTranscoder interface is to be implemented by classes that
- * perform image transcoding operations, that is, take images written
- * in one format and write them in another format using
- * read/write operations. Some image data can be lost in such processes.
- * The ImageTranscoder interface converts metadata objects (IIOMetadata)
- * of ImageReader to apropriate metadata object for ImageWriter.
+ * The ImageTranscoder interface is to be implemented by classes that perform
+ * image transcoding operations, that is, take images written in one format and
+ * write them in another format using read/write operations. Some image data can
+ * be lost in such processes. The ImageTranscoder interface converts metadata
+ * objects (IIOMetadata) of ImageReader to appropriate metadata object for
+ * ImageWriter.
+ * 
+ * @since Android 1.0
  */
 public interface ImageTranscoder {
-    
+
     /**
      * Converts the specified IIOMetadata object using the specified
      * ImageWriteParam for obtaining writer's metadata structure.
      * 
-     * @param inData the IIOMetadata.
-     * @param param the ImageWriteParam.
-     * 
+     * @param inData
+     *            the IIOMetadata.
+     * @param param
+     *            the ImageWriteParam.
      * @return the IIOMetadata, or null.
      */
     IIOMetadata convertStreamMetadata(IIOMetadata inData, ImageWriteParam param);
 
     /**
      * Converts the specified IIOMetadata object using the specified
-     * ImageWriteParam for obtaining writer's metadata structure 
-     * and ImageTypeSpecifier object for obtaining the layout and 
-     * color information of the image for this metadata.
+     * ImageWriteParam for obtaining writer's metadata structure and
+     * ImageTypeSpecifier object for obtaining the layout and color information
+     * of the image for this metadata.
      * 
-     * @param inData the IIOMetadata.
-     * @param imageType the ImageTypeSpecifier.
-     * @param param the ImageWriteParam.
-     * 
+     * @param inData
+     *            the IIOMetadata.
+     * @param imageType
+     *            the ImageTypeSpecifier.
+     * @param param
+     *            the ImageWriteParam.
      * @return the IIOMetadata, or null.
      */
-    IIOMetadata convertImageMetadata(IIOMetadata inData, ImageTypeSpecifier imageType, ImageWriteParam param);
+    IIOMetadata convertImageMetadata(IIOMetadata inData, ImageTypeSpecifier imageType,
+            ImageWriteParam param);
 }
diff --git a/awt/javax/imageio/ImageTypeSpecifier.java b/awt/javax/imageio/ImageTypeSpecifier.java
index c93f269..505b1c4 100644
--- a/awt/javax/imageio/ImageTypeSpecifier.java
+++ b/awt/javax/imageio/ImageTypeSpecifier.java
@@ -18,6 +18,7 @@
  * @author Rustem V. Rafikov
  * @version $Revision: 1.3 $
  */
+
 package javax.imageio;
 
 import java.awt.image.ColorModel;
@@ -27,27 +28,31 @@
 import java.awt.color.ColorSpace;
 
 /**
- * The ImageTypeSpecifier class performs conversion operations
- * on the SampleModel and the ColorModel of an image.
+ * The ImageTypeSpecifier class performs conversion operations on the
+ * SampleModel and the ColorModel of an image.
+ * 
+ * @since Android 1.0
  */
 public class ImageTypeSpecifier {
-    
-    /** 
+
+    /**
      * The ColorModel of this ImageTypeSpecifier.
      */
     protected ColorModel colorModel;
-    
-    /** 
-     * The SampleModel of this ImageTypeSpecifier. 
+
+    /**
+     * The SampleModel of this ImageTypeSpecifier.
      */
     protected SampleModel sampleModel;
 
     /**
-     * Instantiates a new ImageTypeSpecifier with the specified
-     * ColorModel and SampleModel objects.
+     * Instantiates a new ImageTypeSpecifier with the specified ColorModel and
+     * SampleModel objects.
      * 
-     * @param colorModel the ColorModel.
-     * @param sampleModel the SampleModel.
+     * @param colorModel
+     *            the ColorModel.
+     * @param sampleModel
+     *            the SampleModel.
      */
     public ImageTypeSpecifier(ColorModel colorModel, SampleModel sampleModel) {
         if (colorModel == null) {
@@ -65,10 +70,10 @@
     }
 
     /**
-     * Instantiates a new ImageTypeSpecifier using the specified 
-     * RenderedImage.
+     * Instantiates a new ImageTypeSpecifier using the specified RenderedImage.
      * 
-     * @param renderedImage the RenderedImage.
+     * @param renderedImage
+     *            the RenderedImage.
      */
     public ImageTypeSpecifier(RenderedImage renderedImage) {
         if (renderedImage == null) {
@@ -79,136 +84,139 @@
     }
 
     /**
-     * Creates an ImageTypeSpecifier with the specified
-     * DirectColorModel and a packed SampleModel.
+     * Creates an ImageTypeSpecifier with the specified DirectColorModel and a
+     * packed SampleModel.
      * 
-     * @param colorSpace the ColorSpace.
-     * @param redMask the red mask.
-     * @param greenMask the green mask.
-     * @param blueMask the blue mask.
-     * @param alphaMask the alpha mask.
-     * @param transferType the transfer type.
-     * @param isAlphaPremultiplied the parameter indicates
-     * if the color channel is premultiplied by alpha.
-     * 
+     * @param colorSpace
+     *            the ColorSpace.
+     * @param redMask
+     *            the red mask.
+     * @param greenMask
+     *            the green mask.
+     * @param blueMask
+     *            the blue mask.
+     * @param alphaMask
+     *            the alpha mask.
+     * @param transferType
+     *            the transfer type.
+     * @param isAlphaPremultiplied
+     *            the parameter indicates if the color channel is pre-multiplied
+     *            by alpha.
      * @return the ImageTypeSpecifier.
      */
-    public static ImageTypeSpecifier createPacked(ColorSpace colorSpace,
-                                                  int redMask,
-                                                  int greenMask,
-                                                  int blueMask,
-                                                  int alphaMask,
-                                                  int transferType,
-                                                  boolean isAlphaPremultiplied) {
+    public static ImageTypeSpecifier createPacked(ColorSpace colorSpace, int redMask,
+            int greenMask, int blueMask, int alphaMask, int transferType,
+            boolean isAlphaPremultiplied) {
         throw new UnsupportedOperationException("Not supported yet");
     }
 
     /**
-     * Creates an ImageTypeSpecifier with specified
-     * ComponentColorModel and a PixelInterleavedSampleModel.
+     * Creates an ImageTypeSpecifier with specified ComponentColorModel and a
+     * PixelInterleavedSampleModel.
      * 
-     * @param colorSpace the ColorSpace.
-     * @param bandOffsets the band offsets.
-     * @param dataType the data type.
-     * @param hasAlpha the parameter indicates if alpha channel
-     * is needed.
-     * @param isAlphaPremultiplied the parameter indicates
-     * if the color channel is premultiplied by alpha.
-     * 
+     * @param colorSpace
+     *            the ColorSpace.
+     * @param bandOffsets
+     *            the band offsets.
+     * @param dataType
+     *            the data type.
+     * @param hasAlpha
+     *            the parameter indicates if alpha channel is needed.
+     * @param isAlphaPremultiplied
+     *            the parameter indicates if the color channel is pre-multiplied
+     *            by alpha.
      * @return the ImageTypeSpecifier.
      */
-    public static ImageTypeSpecifier createInterleaved(ColorSpace colorSpace,
-                                                       int[] bandOffsets,
-                                                       int dataType,
-                                                       boolean hasAlpha,
-                                                       boolean isAlphaPremultiplied) {
+    public static ImageTypeSpecifier createInterleaved(ColorSpace colorSpace, int[] bandOffsets,
+            int dataType, boolean hasAlpha, boolean isAlphaPremultiplied) {
         throw new UnsupportedOperationException("Not supported yet");
     }
 
-
     /**
-     * Creates a ImageTypeSpecifier for a image with a 
-     * BandedSampleModel and a ComponentColorModel.
+     * Creates a ImageTypeSpecifier for a image with a BandedSampleModel and a
+     * ComponentColorModel.
      * 
-     * @param colorSpace the ColorSpace.
-     * @param bankIndices the bank indices.
-     * @param bandOffsets the band offsets.
-     * @param dataType the data type.
-     * @param hasAlpha the parameter indicates a presence of alpha channel.
-     * @param isAlphaPremultiplied the parameter indicates whether
-     * or not color channel is alpha premultiplied.
-     * 
+     * @param colorSpace
+     *            the ColorSpace.
+     * @param bankIndices
+     *            the bank indices.
+     * @param bandOffsets
+     *            the band offsets.
+     * @param dataType
+     *            the data type.
+     * @param hasAlpha
+     *            the parameter indicates a presence of alpha channel.
+     * @param isAlphaPremultiplied
+     *            the parameter indicates whether or not color channel is alpha
+     *            pre-multiplied.
      * @return the image type specifier
      */
-    public static ImageTypeSpecifier createBanded(ColorSpace colorSpace,
-                                                  int[] bankIndices,
-                                                  int[] bandOffsets,
-                                                  int dataType,
-                                                  boolean hasAlpha,
-                                                  boolean isAlphaPremultiplied) {
+    public static ImageTypeSpecifier createBanded(ColorSpace colorSpace, int[] bankIndices,
+            int[] bandOffsets, int dataType, boolean hasAlpha, boolean isAlphaPremultiplied) {
         throw new UnsupportedOperationException("Not supported yet");
     }
 
     /**
      * Creates a ImageTypeSpecifier for a grayscale image.
      * 
-     * @param bits the number of bits per gray value.
-     * @param dataType the data type.
-     * @param isSigned a signed flag.
-     * 
+     * @param bits
+     *            the number of bits per gray value.
+     * @param dataType
+     *            the data type.
+     * @param isSigned
+     *            a signed flag.
      * @return the ImageTypeSpecifier.
      */
-    public static ImageTypeSpecifier createGrayscale(int bits,
-                                                     int dataType,
-                                                     boolean isSigned) {
+    public static ImageTypeSpecifier createGrayscale(int bits, int dataType, boolean isSigned) {
         throw new UnsupportedOperationException("Not supported yet");
     }
 
     /**
      * Creates a ImageTypeSpecifier for a grayscale image.
      * 
-     * @param bits the number of bits per gray value.
-     * @param dataType the data type.
-     * @param isSigned a signed flag.
-     * @param isAlphaPremultiplied the parameter indicates
-     * if color channel is premultiplied by alpha, or not.
-     * 
+     * @param bits
+     *            the number of bits per gray value.
+     * @param dataType
+     *            the data type.
+     * @param isSigned
+     *            a signed flag.
+     * @param isAlphaPremultiplied
+     *            the parameter indicates if color channel is pre-multiplied by
+     *            alpha, or not.
      * @return the ImageTypeSpecifier.
      */
-    public static ImageTypeSpecifier createGrayscale(int bits,
-                                                     int dataType,
-                                                     boolean isSigned,
-                                                     boolean isAlphaPremultiplied) {
+    public static ImageTypeSpecifier createGrayscale(int bits, int dataType, boolean isSigned,
+            boolean isAlphaPremultiplied) {
         throw new UnsupportedOperationException("Not supported yet");
     }
 
     /**
      * Creates a ImageTypeSpecifier with the indexed image format.
      * 
-     * @param redLUT the red values of indecies.
-     * @param greenLUT the green values of indecies.
-     * @param blueLUT the blue values of indecies.
-     * @param alphaLUT the alpha values of indecies.
-     * @param bits the bits number for each index.
-     * @param dataType the data type.
-     * 
+     * @param redLUT
+     *            the red values of indices.
+     * @param greenLUT
+     *            the green values of indices.
+     * @param blueLUT
+     *            the blue values of indices.
+     * @param alphaLUT
+     *            the alpha values of indices.
+     * @param bits
+     *            the bits number for each index.
+     * @param dataType
+     *            the data type.
      * @return the ImageTypeSpecifier.
      */
-    public static ImageTypeSpecifier createIndexed(byte[] redLUT,
-                                                   byte[] greenLUT,
-                                                   byte[] blueLUT,
-                                                   byte[] alphaLUT,
-                                                   int bits,
-                                                   int dataType) {
+    public static ImageTypeSpecifier createIndexed(byte[] redLUT, byte[] greenLUT, byte[] blueLUT,
+            byte[] alphaLUT, int bits, int dataType) {
         throw new UnsupportedOperationException("Not supported yet");
     }
 
     /**
-     * Creates the ImageTypeSpecifier from 
-     * the specified buffered image type.
+     * Creates the ImageTypeSpecifier from the specified buffered image type.
      * 
-     * @param bufferedImageType the buffered image type.
-     * 
+     * @param bufferedImageType
+     *            the buffered image type.
      * @return the ImageTypeSpecifier.
      */
     public static ImageTypeSpecifier createFromBufferedImageType(int bufferedImageType) {
@@ -216,11 +224,10 @@
     }
 
     /**
-     * Creates the ImageTypeSpecifier from 
-     * the specified RenderedImage.
+     * Creates the ImageTypeSpecifier from the specified RenderedImage.
      * 
-     * @param image the RenderedImage.
-     * 
+     * @param image
+     *            the RenderedImage.
      * @return the ImageTypeSpecifier.
      */
     public static ImageTypeSpecifier createFromRenderedImage(RenderedImage image) {
@@ -242,7 +249,7 @@
     /**
      * Gets the number of components.
      * 
-     * @return the number of components
+     * @return the number of components.
      */
     public int getNumComponents() {
         return colorModel.getNumComponents();
@@ -251,7 +258,7 @@
     /**
      * Gets the number of bands.
      * 
-     * @return the number of bands
+     * @return the number of bands.
      */
     public int getNumBands() {
         return sampleModel.getNumBands();
@@ -260,8 +267,8 @@
     /**
      * Gets the number of bits per the specified band.
      * 
-     * @param band the index of band.
-     * 
+     * @param band
+     *            the index of band.
      * @return the number of bits per the specified band.
      */
     public int getBitsPerBand(int band) {
@@ -283,13 +290,14 @@
     /**
      * Gets a compatible SampleModel with the specified width and height.
      * 
-     * @param width the width.
-     * @param height the height.
-     * 
+     * @param width
+     *            the width.
+     * @param height
+     *            the height.
      * @return the SampleModel.
      */
     public SampleModel getSampleModel(int width, int height) {
-        if ((long)width*height > Integer.MAX_VALUE) {
+        if ((long)width * height > Integer.MAX_VALUE) {
             throw new IllegalArgumentException("width * height > Integer.MAX_VALUE");
         }
         return sampleModel.createCompatibleSampleModel(width, height);
@@ -298,20 +306,21 @@
     /**
      * Gets the ColorModel associated with this ImageTypeSpecifier.
      * 
-     * @return the ColorModel associated with this ImageTypeSpecifier. 
+     * @return the ColorModel associated with this ImageTypeSpecifier.
      */
     public ColorModel getColorModel() {
         return colorModel;
     }
 
     /**
-     * Creates the BufferedImage with the specified width and height 
-     * and the ColorMadel and SampleModel which are specified by this 
+     * Creates the BufferedImage with the specified width and height and the
+     * ColorMadel and SampleModel which are specified by this
      * ImageTypeSpecifier.
      * 
-     * @param width the width of the BufferedImage.
-     * @param height the height of the BufferedImage.
-     * 
+     * @param width
+     *            the width of the BufferedImage.
+     * @param height
+     *            the height of the BufferedImage.
      * @return the BufferedImage.
      */
     public BufferedImage createBufferedImage(int width, int height) {
@@ -319,19 +328,18 @@
     }
 
     /**
-     * Compares this ImageTypeSpecifier object with the specified 
-     * object.
+     * Compares this ImageTypeSpecifier object with the specified object.
      * 
-     * @param o the Object to be compared.
-     * 
-     * @return true, if the object is an ImageTypeSpecifier with the same
-     * data as this ImageTypeSpecifier, false otherwise.
+     * @param o
+     *            the Object to be compared.
+     * @return true, if the object is an ImageTypeSpecifier with the same data
+     *         as this ImageTypeSpecifier, false otherwise.
      */
     @Override
     public boolean equals(Object o) {
         boolean rt = false;
         if (o instanceof ImageTypeSpecifier) {
-            ImageTypeSpecifier ts = (ImageTypeSpecifier) o;
+            ImageTypeSpecifier ts = (ImageTypeSpecifier)o;
             rt = colorModel.equals(ts.colorModel) && sampleModel.equals(ts.sampleModel);
         }
         return rt;
diff --git a/awt/javax/imageio/ImageWriteParam.java b/awt/javax/imageio/ImageWriteParam.java
index d32fa59..d661889 100644
--- a/awt/javax/imageio/ImageWriteParam.java
+++ b/awt/javax/imageio/ImageWriteParam.java
@@ -18,103 +18,141 @@
  * @author Rustem V. Rafikov
  * @version $Revision: 1.3 $
  */
+
 package javax.imageio;
 
 import java.util.Locale;
 import java.awt.*;
 
 /**
- * The ImageWriteParam class provides information to an ImageWriter 
- * about how an image is to be encoded.
+ * The ImageWriteParam class provides information to an ImageWriter about how an
+ * image is to be encoded.
+ * 
+ * @since Android 1.0
  */
 public class ImageWriteParam extends IIOParam {
 
-    /** 
-     * The Constant MODE_DISABLED indicates that 
-     * stream is not tiled, progressive, or compressed.
+    /**
+     * The Constant MODE_DISABLED indicates that stream is not tiled,
+     * progressive, or compressed.
      */
     public static final int MODE_DISABLED = 0;
-    
-    /** 
-     * The Constant MODE_DEFAULT indicates that the stream will be tiled, 
-     * progressive, or compressed according to the plug-in's default. 
+
+    /**
+     * The Constant MODE_DEFAULT indicates that the stream will be tiled,
+     * progressive, or compressed according to the plug-in's default.
      */
     public static final int MODE_DEFAULT = 1;
-    
-    /** 
+
+    /**
      * The Constant MODE_EXPLICIT indicates that the stream will be tiled,
-     * progressive, or compressed according to current settings
-     * which are defined by set methods. 
+     * progressive, or compressed according to current settings which are
+     * defined by set methods.
      */
     public static final int MODE_EXPLICIT = 2;
-    
-    /** 
-     * The Constant MODE_COPY_FROM_METADATA indicates that the stream
-     * will be tiled, progressive, or compressed according to
-     * stream or image metadata. 
+
+    /**
+     * The Constant MODE_COPY_FROM_METADATA indicates that the stream will be
+     * tiled, progressive, or compressed according to stream or image metadata.
      */
     public static final int MODE_COPY_FROM_METADATA = 3;
-    
-    /** Whether the ImageWriter can write tiles. */
+
+    /**
+     * Whether the ImageWriter can write tiles.
+     */
     protected boolean canWriteTiles = false;
-    
-    /** The tiling mode. */
+
+    /**
+     * The tiling mode.
+     */
     protected int tilingMode = MODE_COPY_FROM_METADATA;
-    
-    /** The preferred tile sizes. */
+
+    /**
+     * The preferred tile sizes.
+     */
     protected Dimension[] preferredTileSizes = null;
-    
-    /** The tiling set. */
+
+    /**
+     * The tiling set.
+     */
     protected boolean tilingSet = false;
-    
-    /** The tile width. */
+
+    /**
+     * The tile width.
+     */
     protected int tileWidth = 0;
-    
-    /** The tile height. */
+
+    /**
+     * The tile height.
+     */
     protected int tileHeight = 0;
-    
-    /** Whether the ImageWriter can offset tiles. */
+
+    /**
+     * Whether the ImageWriter can offset tiles.
+     */
     protected boolean canOffsetTiles = false;
-    
-    /** The tile grid x offset. */
+
+    /**
+     * The tile grid x offset.
+     */
     protected int tileGridXOffset = 0;
-    
-    /** The tile grid y offset. */
+
+    /**
+     * The tile grid y offset.
+     */
     protected int tileGridYOffset = 0;
-    
-    /** Whether the ImageWriter can write in progressive mode. */
+
+    /**
+     * Whether the ImageWriter can write in progressive mode.
+     */
     protected boolean canWriteProgressive = false;
-    
-    /** The progressive mode. */
+
+    /**
+     * The progressive mode.
+     */
     protected int progressiveMode = MODE_COPY_FROM_METADATA;
-    
-    /** Whether the ImageWriter can write in compressed mode. */
+
+    /**
+     * Whether the ImageWriter can write in compressed mode.
+     */
     protected boolean canWriteCompressed = false;
-    
-    /** The compression mode. */
+
+    /**
+     * The compression mode.
+     */
     protected int compressionMode = MODE_COPY_FROM_METADATA;
-    
-    /** The compression types. */
+
+    /**
+     * The compression types.
+     */
     protected String[] compressionTypes = null;
-    
-    /** The compression type. */
+
+    /**
+     * The compression type.
+     */
     protected String compressionType = null;
-    
-    /** The compression quality. */
+
+    /**
+     * The compression quality.
+     */
     protected float compressionQuality = 1.0f;
-    
-    /** The locale. */
+
+    /**
+     * The locale.
+     */
     protected Locale locale = null;
 
     /**
      * Instantiates a new ImageWriteParam.
      */
-    protected ImageWriteParam() {}
+    protected ImageWriteParam() {
+    }
 
     /**
      * Instantiates a new ImageWriteParam with the specified Locale.
      * 
-     * @param locale the Locale.
+     * @param locale
+     *            the Locale.
      */
     public ImageWriteParam(Locale locale) {
         this.locale = locale;
@@ -122,7 +160,7 @@
     }
 
     /**
-     * Gets the mode for writing the stream in a progressive sequence. 
+     * Gets the mode for writing the stream in a progressive sequence.
      * 
      * @return the current progressive mode.
      */
@@ -134,24 +172,24 @@
     }
 
     /**
-     * Returns true if images can be written using 
-     * increasing quality passes by progressive.  
+     * Returns true if images can be written using increasing quality passes by
+     * progressive.
      * 
-     * @return true if images can be written using 
-     * increasing quality passes by progressive, false otherwise.
+     * @return true if images can be written using increasing quality passes by
+     *         progressive, false otherwise.
      */
     public boolean canWriteProgressive() {
         return canWriteProgressive;
     }
 
     /**
-     * Sets the progressive mode which defines whether the stream 
-     * contains a progressive sequence of increasing quality
-     * during writing. The progressive mode should be one of
-     * the following values: MODE_DISABLED, MODE_DEFAULT, or
-     * MODE_COPY_FROM_METADATA.
+     * Sets the progressive mode which defines whether the stream contains a
+     * progressive sequence of increasing quality during writing. The
+     * progressive mode should be one of the following values: MODE_DISABLED,
+     * MODE_DEFAULT, or MODE_COPY_FROM_METADATA.
      * 
-     * @param mode the new progressive mode.
+     * @param mode
+     *            the new progressive mode.
      */
     public void setProgressiveMode(int mode) {
         if (canWriteProgressive()) {
@@ -164,22 +202,21 @@
     }
 
     /**
-     * Returns true if the writer can use tiles with non zero 
-     * grid offsets while writing. 
+     * Returns true if the writer can use tiles with non zero grid offsets while
+     * writing.
      * 
-     * @return true if the writer can use tiles with non zero 
-     * grid offsets while writing, false otherwise.
+     * @return true, if the writer can use tiles with non zero grid offsets
+     *         while writing, false otherwise.
      */
     public boolean canOffsetTiles() {
         return canOffsetTiles;
     }
 
     /**
-     * Returns true if this writer can write images with 
-     * compression.  
+     * Returns true if this writer can write images with compression.
      * 
-     * @return true, true if this writer can write images with 
-     * compression, false otherwise.
+     * @return true, if this writer can write images with compression, false
+     *         otherwise.
      */
     public boolean canWriteCompressed() {
         return canWriteCompressed;
@@ -188,7 +225,7 @@
     /**
      * Returns true if the writer can write tiles.
      * 
-     * @return true if the writer can write tiles, false otherwise.
+     * @return true, if the writer can write tiles, false otherwise.
      */
     public boolean canWriteTiles() {
         return canWriteTiles;
@@ -247,8 +284,7 @@
     /**
      * Gets the current compression type, or returns null.
      * 
-     * @return the current compression type, or returns null 
-     * if it is not set.
+     * @return the current compression type, or returns null if it is not set.
      */
     public String getCompressionType() {
         checkWriteCompressed();
@@ -257,14 +293,12 @@
     }
 
     /**
-     * Gets a bit rate which represents an estimate of the number of bits 
-     * of output data for each bit of input image data with the specified 
-     * quality.
+     * Gets a bit rate which represents an estimate of the number of bits of
+     * output data for each bit of input image data with the specified quality.
      * 
-     * @param quality the quality.
-     * 
-     * @return an estimate of the bit rate, or -1.0F if there is no 
-     * estimate. 
+     * @param quality
+     *            the quality.
+     * @return an estimate of the bit rate, or -1.0F if there is no estimate.
      */
     public float getBitRate(float quality) {
         checkWriteCompressed();
@@ -301,8 +335,7 @@
     }
 
     /**
-     * Gets an array of floats which decribe 
-     * compression quality levels. 
+     * Gets an array of floats which describes compression quality levels.
      * 
      * @return the array of compression quality values.
      */
@@ -323,7 +356,7 @@
     }
 
     /**
-     * Gets the current compression type using the current Locale. 
+     * Gets the current compression type using the current Locale.
      * 
      * @return the current compression type using the current Locale.
      */
@@ -377,8 +410,8 @@
     }
 
     /**
-     * Gets an array of Dimensions giving the sizes of the tiles as 
-     * they are encoded in the output file or stream. 
+     * Gets an array of Dimensions giving the sizes of the tiles as they are
+     * encoded in the output file or stream.
      * 
      * @return the preferred tile sizes.
      */
@@ -420,11 +453,10 @@
     }
 
     /**
-     * Gets the tile height in an image as it is written to the 
-     * output stream.
+     * Gets the tile height in an image as it is written to the output stream.
      * 
-     * @return the tile height in an image as it is written to the 
-     * output stream.
+     * @return the tile height in an image as it is written to the output
+     *         stream.
      */
     public int getTileHeight() {
         checkTiling();
@@ -434,11 +466,9 @@
     }
 
     /**
-     * Gets the tile width in an image as it is written to the 
-     * output stream.
+     * Gets the tile width in an image as it is written to the output stream.
      * 
-     * @return the tile width in an image as it is written to the 
-     * output stream.
+     * @return the tile width in an image as it is written to the output stream.
      */
     public int getTileWidth() {
         checkTiling();
@@ -448,11 +478,10 @@
     }
 
     /**
-     * Checks if the current compression type has lossless 
-     * compression or not. 
+     * Checks if the current compression type has lossless compression or not.
      * 
-     * @return true, if the current compression type has lossless 
-     * compression, false otherwise.
+     * @return true, if the current compression type has lossless compression,
+     *         false otherwise.
      */
     public boolean isCompressionLossless() {
         checkWriteCompressed();
@@ -472,12 +501,12 @@
     }
 
     /**
-     * Sets the compression mode to the specified value.
-     * The specified mode can be one of the predefined
-     * constants: MODE_DEFAULT, MODE_DISABLED, MODE_EXPLICIT, 
-     * or MODE_COPY_FROM_METADATA.
-     *  
-     * @param mode the new compression mode to be set.
+     * Sets the compression mode to the specified value. The specified mode can
+     * be one of the predefined constants: MODE_DEFAULT, MODE_DISABLED,
+     * MODE_EXPLICIT, or MODE_COPY_FROM_METADATA.
+     * 
+     * @param mode
+     *            the new compression mode to be set.
      */
     public void setCompressionMode(int mode) {
         checkWriteCompressed();
@@ -502,8 +531,8 @@
     /**
      * Sets the compression quality. The value should be between 0 and 1.
      * 
-     * @param quality the new compression quality, 
-     * float value between 0 and 1. 
+     * @param quality
+     *            the new compression quality, float value between 0 and 1.
      */
     public void setCompressionQuality(float quality) {
         checkWriteCompressed();
@@ -516,11 +545,11 @@
     }
 
     /**
-     * Sets the compression type. The specified string
-     * should be one of the values returned 
-     * by getCompressionTypes method.
+     * Sets the compression type. The specified string should be one of the
+     * values returned by getCompressionTypes method.
      * 
-     * @param compressionType the new compression type.
+     * @param compressionType
+     *            the new compression type.
      */
     public void setCompressionType(String compressionType) {
         checkWriteCompressed();
@@ -547,13 +576,17 @@
     }
 
     /**
-     * Sets the instruction that tiling should be performed for 
-     * the image in the output stream with the specified parameters. 
+     * Sets the instruction that tiling should be performed for the image in the
+     * output stream with the specified parameters.
      * 
-     * @param tileWidth the tile's width.
-     * @param tileHeight the tile's height.
-     * @param tileGridXOffset the tile grid's x offset.
-     * @param tileGridYOffset the tile grid's y offset.
+     * @param tileWidth
+     *            the tile's width.
+     * @param tileHeight
+     *            the tile's height.
+     * @param tileGridXOffset
+     *            the tile grid's x offset.
+     * @param tileGridYOffset
+     *            the tile grid's y offset.
      */
     public void setTiling(int tileWidth, int tileHeight, int tileGridXOffset, int tileGridYOffset) {
         checkTiling();
@@ -563,19 +596,17 @@
             throw new UnsupportedOperationException("Can't offset tiles!");
         }
 
-        if (tileWidth <=0 || tileHeight <= 0) {
+        if (tileWidth <= 0 || tileHeight <= 0) {
             throw new IllegalArgumentException("tile dimensions are non-positive!");
         }
 
         Dimension preferredTileSizes[] = getPreferredTileSizes();
         if (preferredTileSizes != null) {
-            for (int i = 0; i < preferredTileSizes.length; i+=2) {
+            for (int i = 0; i < preferredTileSizes.length; i += 2) {
                 Dimension minSize = preferredTileSizes[i];
-                Dimension maxSize = preferredTileSizes[i+1];
-                if (
-                        tileWidth < minSize.width || tileWidth > maxSize.width ||
-                        tileHeight < minSize.height || tileHeight > maxSize.height
-                ) {
+                Dimension maxSize = preferredTileSizes[i + 1];
+                if (tileWidth < minSize.width || tileWidth > maxSize.width
+                        || tileHeight < minSize.height || tileHeight > maxSize.height) {
                     throw new IllegalArgumentException("Illegal tile size!");
                 }
             }
@@ -603,11 +634,12 @@
     }
 
     /**
-     * Sets the tiling mode. The specified mode should be one of the 
-     * following values: MODE_DISABLED, MODE_DEFAULT, MODE_EXPLICIT,
-     * or MODE_COPY_FROM_METADATA.
+     * Sets the tiling mode. The specified mode should be one of the following
+     * values: MODE_DISABLED, MODE_DEFAULT, MODE_EXPLICIT, or
+     * MODE_COPY_FROM_METADATA.
      * 
-     * @param mode the new tiling mode.
+     * @param mode
+     *            the new tiling mode.
      */
     public void setTilingMode(int mode) {
         checkTiling();
@@ -630,4 +662,3 @@
         }
     }
 }
-
diff --git a/awt/javax/imageio/ImageWriter.java b/awt/javax/imageio/ImageWriter.java
index d6119b0..86879e0 100644
--- a/awt/javax/imageio/ImageWriter.java
+++ b/awt/javax/imageio/ImageWriter.java
@@ -18,6 +18,7 @@
  * @author Rustem V. Rafikov
  * @version $Revision: 1.3 $
  */
+
 package javax.imageio;
 
 import java.awt.Dimension;
@@ -40,34 +41,49 @@
 import javax.imageio.spi.ImageWriterSpi;
 
 /**
- * The ImageWriter class is an abstract class for encoding images.
- * ImageWriter objects are instantiated by the service provider 
- * interface, ImageWriterSpi class, for the specific format. 
- * ImageWriterSpi class should be registered with the IIORegistry, 
- * which uses them for format recognition and presentation of available 
- * format readers and writers.
+ * The ImageWriter class is an abstract class for encoding images. ImageWriter
+ * objects are instantiated by the service provider interface, ImageWriterSpi
+ * class, for the specific format. ImageWriterSpi class should be registered
+ * with the IIORegistry, which uses them for format recognition and presentation
+ * of available format readers and writers.
+ * 
+ * @since Android 1.0
  */
 public abstract class ImageWriter implements ImageTranscoder {
 
-    /** The available locales. */
+    /**
+     * The available locales.
+     */
     protected Locale[] availableLocales;
-    
-    /** The locale. */
+
+    /**
+     * The locale.
+     */
     protected Locale locale;
-    
-    /** The originating provider. */
+
+    /**
+     * The originating provider.
+     */
     protected ImageWriterSpi originatingProvider;
-    
-    /** The output. */
+
+    /**
+     * The output.
+     */
     protected Object output;
-    
-    /** The progress listeners. */
+
+    /**
+     * The progress listeners.
+     */
     protected List<IIOWriteProgressListener> progressListeners;
-    
-    /** The warning listeners. */
+
+    /**
+     * The warning listeners.
+     */
     protected List<IIOWriteWarningListener> warningListeners;
-    
-    /** The warning locales. */
+
+    /**
+     * The warning locales.
+     */
     protected List<Locale> warningLocales;
 
     // Indicates that abort operation is requested
@@ -78,22 +94,21 @@
     /**
      * Instantiates a new ImageWriter.
      * 
-     * @param originatingProvider the ImageWriterSpi which 
-     * instanties this ImageWriter.
+     * @param originatingProvider
+     *            the ImageWriterSpi which instantiates this ImageWriter.
      */
     protected ImageWriter(ImageWriterSpi originatingProvider) {
         this.originatingProvider = originatingProvider;
     }
 
     public abstract IIOMetadata convertStreamMetadata(IIOMetadata iioMetadata,
-                                             ImageWriteParam imageWriteParam);
+            ImageWriteParam imageWriteParam);
 
     public abstract IIOMetadata convertImageMetadata(IIOMetadata iioMetadata,
-                                            ImageTypeSpecifier imageTypeSpecifier,
-                                            ImageWriteParam imageWriteParam);
+            ImageTypeSpecifier imageTypeSpecifier, ImageWriteParam imageWriteParam);
 
     /**
-     * Gets the ImageWriterSpi which instantiated this ImageWriter. 
+     * Gets the ImageWriterSpi which instantiated this ImageWriter.
      * 
      * @return the ImageWriterSpi.
      */
@@ -102,10 +117,11 @@
     }
 
     /**
-     * Processes the start of an image read by calling their imageStarted
-     * method of registered IIOWriteProgressListeners.
+     * Processes the start of an image read by calling their imageStarted method
+     * of registered IIOWriteProgressListeners.
      * 
-     * @param imageIndex the image index.
+     * @param imageIndex
+     *            the image index.
      */
     protected void processImageStarted(int imageIndex) {
         if (null != progressListeners) {
@@ -116,10 +132,11 @@
     }
 
     /**
-     * Processes the current percentage of image completion by calling 
+     * Processes the current percentage of image completion by calling
      * imageProgress method of registered IIOWriteProgressListener.
      * 
-     * @param percentageDone the percentage done.
+     * @param percentageDone
+     *            the percentage done.
      */
     protected void processImageProgress(float percentageDone) {
         if (null != progressListeners) {
@@ -130,8 +147,8 @@
     }
 
     /**
-     * Processes image completion by calling imageComplete method
-     * of registered IIOWriteProgressListeners. 
+     * Processes image completion by calling imageComplete method of registered
+     * IIOWriteProgressListeners.
      */
     protected void processImageComplete() {
         if (null != progressListeners) {
@@ -142,11 +159,13 @@
     }
 
     /**
-     * Processes a warning message by calling warningOccurred method
-     * of registered IIOWriteWarningListeners.
+     * Processes a warning message by calling warningOccurred method of
+     * registered IIOWriteWarningListeners.
      * 
-     * @param imageIndex the image index.
-     * @param warning the warning.
+     * @param imageIndex
+     *            the image index.
+     * @param warning
+     *            the warning.
      */
     protected void processWarningOccurred(int imageIndex, String warning) {
         if (null == warning) {
@@ -160,13 +179,15 @@
     }
 
     /**
-     * Processes a warning message by calling warningOccurred method
-     * of registered IIOWriteWarningListeners with string from 
-     * ResourceBundle.
+     * Processes a warning message by calling warningOccurred method of
+     * registered IIOWriteWarningListeners with string from ResourceBundle.
      * 
-     * @param imageIndex the image index.
-     * @param bundle the name of ResourceBundle.
-     * @param key the keyword.
+     * @param imageIndex
+     *            the image index.
+     * @param bundle
+     *            the name of ResourceBundle.
+     * @param key
+     *            the keyword.
      */
     protected void processWarningOccurred(int imageIndex, String bundle, String key) {
         if (warningListeners != null) { // Don't check the parameters
@@ -180,17 +201,18 @@
             throw new IllegalArgumentException("keyword == null!");
         }
 
-        // Get the context class loader and try to locate the bundle with it first
-        ClassLoader contextClassloader = AccessController.doPrivileged(
-                new PrivilegedAction<ClassLoader>() {
+        // Get the context class loader and try to locate the bundle with it
+        // first
+        ClassLoader contextClassloader = AccessController
+                .doPrivileged(new PrivilegedAction<ClassLoader>() {
                     public ClassLoader run() {
                         return Thread.currentThread().getContextClassLoader();
                     }
-        });
+                });
 
         // Iterate through both listeners and locales
         int n = warningListeners.size();
-        for (int i=0; i < n; i++) {
+        for (int i = 0; i < n; i++) {
             IIOWriteWarningListener listener = warningListeners.get(i);
             Locale locale = warningLocales.get(i);
 
@@ -218,10 +240,11 @@
     }
 
     /**
-     * Sets the specified Object to the output of this ImageWriter. 
+     * Sets the specified Object to the output of this ImageWriter.
      * 
-     * @param output the Object which represents destination, it can 
-     * be ImageOutputStream or other objects.
+     * @param output
+     *            the Object which represents destination, it can be
+     *            ImageOutputStream or other objects.
      */
     public void setOutput(Object output) {
         if (output != null) {
@@ -244,26 +267,26 @@
     }
 
     /**
-     * Writes a completed image stream that contains the specified image, 
+     * Writes a completed image stream that contains the specified image,
      * default metadata, and thumbnails to the output.
      * 
-     * @param image the specified image to be written.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred
-     * during writting.
+     * @param image
+     *            the specified image to be written.
+     * @throws IOException
+     *             if an I/O exception has occurred during writing.
      */
     public void write(IIOImage image) throws IOException {
         write(null, image, null);
     }
 
     /**
-     * Writes a completed image stream that contains the specified 
-     * rendered image, default metadata, and thumbnails to the output.
+     * Writes a completed image stream that contains the specified rendered
+     * image, default metadata, and thumbnails to the output.
      * 
-     * @param image the specified RenderedImage to be written.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred
-     * during writting.
+     * @param image
+     *            the specified RenderedImage to be written.
+     * @throws IOException
+     *             if an I/O exception has occurred during writing.
      */
     public void write(RenderedImage image) throws IOException {
         write(null, new IIOImage(image, null, null), null);
@@ -273,16 +296,18 @@
      * Writes a completed image stream that contains the specified image,
      * metadata and thumbnails to the output.
      * 
-     * @param streamMetadata the stream metadata, or null.
-     * @param image the specified image to be written, if
-     * canWriteRaster() method returns false, then Image must contain 
-     * only RenderedImage.
-     * @param param the ImageWriteParam, or null.
-     * 
-     * @throws IOException - if an error occurs during writing.
+     * @param streamMetadata
+     *            the stream metadata, or null.
+     * @param image
+     *            the specified image to be written, if canWriteRaster() method
+     *            returns false, then Image must contain only RenderedImage.
+     * @param param
+     *            the ImageWriteParam, or null.
+     * @throws IOException
+     *             if an error occurs during writing.
      */
-    public abstract void write(IIOMetadata streamMetadata,
-                               IIOImage image, ImageWriteParam param) throws IOException;
+    public abstract void write(IIOMetadata streamMetadata, IIOImage image, ImageWriteParam param)
+            throws IOException;
 
     /**
      * Disposes of any resources.
@@ -292,26 +317,26 @@
     }
 
     /**
-     * Requests an abort operation for current writing operation. 
+     * Requests an abort operation for current writing operation.
      */
     public synchronized void abort() {
         aborted = true;
     }
 
     /**
-     * Checks whether or not a request to abort the current write operation 
-     * has been made successfully.
+     * Checks whether or not a request to abort the current write operation has
+     * been made successfully.
      * 
-     * @return true, if the request to abort the current write operation 
-     * has been made successfully, false otherwise.
+     * @return true, if the request to abort the current write operation has
+     *         been made successfully, false otherwise.
      */
     protected synchronized boolean abortRequested() {
         return aborted;
     }
 
     /**
-     * Clears all previous abort request, and abortRequested returns false
-     * after calling this method.
+     * Clears all previous abort request, and abortRequested returns false after
+     * calling this method.
      */
     protected synchronized void clearAbortRequest() {
         aborted = false;
@@ -320,7 +345,8 @@
     /**
      * Adds the IIOWriteProgressListener listener.
      * 
-     * @param listener the IIOWriteProgressListener listener.
+     * @param listener
+     *            the IIOWriteProgressListener listener.
      */
     public void addIIOWriteProgressListener(IIOWriteProgressListener listener) {
         if (listener == null) {
@@ -337,7 +363,8 @@
     /**
      * Adds the IIOWriteWarningListener.
      * 
-     * @param listener the IIOWriteWarningListener listener.
+     * @param listener
+     *            the IIOWriteWarningListener listener.
      */
     public void addIIOWriteWarningListener(IIOWriteWarningListener listener) {
         if (listener == null) {
@@ -356,8 +383,8 @@
     /**
      * Gets the output object that was set by setOutput method.
      * 
-     * @return the output object such as ImageOutputStream, or null if
-     * it is not set.
+     * @return the output object such as ImageOutputStream, or null if it is not
+     *         set.
      */
     public Object getOutput() {
         return output;
@@ -366,7 +393,7 @@
     /**
      * Check output return false.
      * 
-     * @return true, if successful
+     * @return true, if successful.
      */
     private final boolean checkOutputReturnFalse() {
         if (getOutput() == null) {
@@ -385,124 +412,122 @@
         throw new UnsupportedOperationException("Unsupported write variant!");
     }
 
-
     /**
-     * Returns true if a new empty image can be inserted at 
-     * the specified index. 
+     * Returns true if a new empty image can be inserted at the specified index.
      * 
-     * @param imageIndex the specified index of image.
-     * 
-     * @return true if a new empty image can be inserted at 
-     * the specified index, false otherwise.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param imageIndex
+     *            the specified index of image.
+     * @return true if a new empty image can be inserted at the specified index,
+     *         false otherwise.
+     * @throws IOException
+     *             Signals that an I/O exception has occurred.
      */
     public boolean canInsertEmpty(int imageIndex) throws IOException {
         return checkOutputReturnFalse();
     }
 
     /**
-     * Returns true if a new image can be inserted at the specified index. 
+     * Returns true if a new image can be inserted at the specified index.
      * 
-     * @param imageIndex the specified index of image.
-     * 
-     * @return true if a new image can be inserted at the specified index, 
-     * false otherwise.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param imageIndex
+     *            the specified index of image.
+     * @return true if a new image can be inserted at the specified index, false
+     *         otherwise.
+     * @throws IOException
+     *             Signals that an I/O exception has occurred.
      */
     public boolean canInsertImage(int imageIndex) throws IOException {
         return checkOutputReturnFalse();
     }
 
     /**
-     * Returnes true if the image with the specified index can be removed.
+     * Returns true if the image with the specified index can be removed.
      * 
-     * @param imageIndex the specified index of image.
-     * 
-     * @return true if the image with the specified index can be removed,
-     * false otherwise.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param imageIndex
+     *            the specified index of image.
+     * @return true if the image with the specified index can be removed, false
+     *         otherwise.
+     * @throws IOException
+     *             Signals that an I/O exception has occurred.
      */
     public boolean canRemoveImage(int imageIndex) throws IOException {
         return checkOutputReturnFalse();
     }
 
     /**
-     * Returns true if metadata of the image with the specified index
-     * can be replaced.
+     * Returns true if metadata of the image with the specified index can be
+     * replaced.
      * 
-     * @param imageIndex the specified image index.
-     * 
-     * @return true if metadata of the image with the specified index
-     * can be replaced, false otherwise.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param imageIndex
+     *            the specified image index.
+     * @return true if metadata of the image with the specified index can be
+     *         replaced, false otherwise.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public boolean canReplaceImageMetadata(int imageIndex) throws IOException {
         return checkOutputReturnFalse();
     }
 
     /**
-     * Returns true if pixels of the image with the specified index 
-     * can be replaced by the replacePixels  methods.
+     * Returns true if pixels of the image with the specified index can be
+     * replaced by the replacePixels methods.
      * 
-     * @param imageIndex the image's index.
-     * 
-     * @return true if pixels of the image with the specified index 
-     * can be replaced by the replacePixels  methods, false otherwise.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param imageIndex
+     *            the image's index.
+     * @return true if pixels of the image with the specified index can be
+     *         replaced by the replacePixels methods, false otherwise.
+     * @throws IOException
+     *             Signals that an I/O exception has occurred.
      */
     public boolean canReplacePixels(int imageIndex) throws IOException {
         return checkOutputReturnFalse();
     }
 
     /**
-     * Returns true if the stream metadata presented in the output
-     * can be removed.
+     * Returns true if the stream metadata presented in the output can be
+     * removed.
      * 
-     * @return true if the stream metadata presented in the output
-     * can be removed, false otherwise.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @return true if the stream metadata presented in the output can be
+     *         removed, false otherwise.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public boolean canReplaceStreamMetadata() throws IOException {
         return checkOutputReturnFalse();
     }
 
     /**
-     * Returns true if the writing of a complete image stream which
-     * contains a single image is supported with undefined pixel 
-     * values and associated metadata and thumbnails to the output. 
+     * Returns true if the writing of a complete image stream which contains a
+     * single image is supported with undefined pixel values and associated
+     * metadata and thumbnails to the output.
      * 
-     * @return true if the writing of a complete image stream which
-     * contains a single image is supported, false otherwise.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @return true if the writing of a complete image stream which contains a
+     *         single image is supported, false otherwise.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public boolean canWriteEmpty() throws IOException {
         return checkOutputReturnFalse();
     }
 
     /**
-     * Returns true if the methods which taken an IIOImageParameter 
-     * can deal with a Raster source image.
+     * Returns true if the methods which taken an IIOImageParameter can deal
+     * with a Raster source image.
      * 
-     * @return true if the methods which taken an IIOImageParameter 
-     * can deal with a Raster source image, false otherwise.
+     * @return true if the methods which taken an IIOImageParameter can deal
+     *         with a Raster source image, false otherwise.
      */
     public boolean canWriteRasters() {
         return false;
     }
 
     /**
-     * Returns true if the writer can add an image to stream that
-     * already contains header information.
+     * Returns true if the writer can add an image to stream that already
+     * contains header information.
      * 
-     * @return if the writer can add an image to stream that
-     * already contains header information, false otherwise.
+     * @return if the writer can add an image to stream that already contains
+     *         header information, false otherwise.
      */
     public boolean canWriteSequence() {
         return false;
@@ -511,16 +536,18 @@
     /**
      * Ends the insertion of a new image.
      * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public void endInsertEmpty() throws IOException {
         unsupportedOperation();
     }
 
     /**
-     * Ends the repalce pixels operation.
+     * Ends the replace pixels operation.
      * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public void endReplacePixels() throws IOException {
         unsupportedOperation();
@@ -529,7 +556,8 @@
     /**
      * Ends an empty write operation.
      * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public void endWriteEmpty() throws IOException {
         unsupportedOperation();
@@ -538,7 +566,8 @@
     /**
      * Ends the sequence of write operations.
      * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public void endWriteSequence() throws IOException {
         unsupportedOperation();
@@ -558,25 +587,24 @@
     }
 
     /**
-     * Gets an IIOMetadata object that contains default values 
-     * for encoding an image with the specified type. 
+     * Gets an IIOMetadata object that contains default values for encoding an
+     * image with the specified type.
      * 
-     * @param imageType the ImageTypeSpecifier.
-     * @param param the ImageWriteParam.
-     * 
+     * @param imageType
+     *            the ImageTypeSpecifier.
+     * @param param
+     *            the ImageWriteParam.
      * @return the IIOMetadata object.
      */
-    public abstract IIOMetadata getDefaultImageMetadata(
-            ImageTypeSpecifier imageType,
-            ImageWriteParam param
-    );
+    public abstract IIOMetadata getDefaultImageMetadata(ImageTypeSpecifier imageType,
+            ImageWriteParam param);
 
     /**
-     * Gets an IIOMetadata object that contains default values 
-     * for encoding a stream of images.
+     * Gets an IIOMetadata object that contains default values for encoding a
+     * stream of images.
      * 
-     * @param param the ImageWriteParam.
-     * 
+     * @param param
+     *            the ImageWriteParam.
      * @return the IIOMetadata object.
      */
     public abstract IIOMetadata getDefaultStreamMetadata(ImageWriteParam param);
@@ -591,9 +619,8 @@
     }
 
     /**
-     * Gets the default write param.
-     * Gets a new ImageWriteParam object for this ImageWriter with the
-     * current Locale.
+     * Gets the default write param. Gets a new ImageWriteParam object for this
+     * ImageWriter with the current Locale.
      * 
      * @return a new ImageWriteParam object for this ImageWriter.
      */
@@ -602,124 +629,131 @@
     }
 
     /**
-     * Gets the number of thumbnails suported by the format 
-     * being written with supported image type, image write 
-     * parameters, stream, and image metadata objects.
+     * Gets the number of thumbnails supported by the format being written with
+     * supported image type, image write parameters, stream, and image metadata
+     * objects.
      * 
-     * @param imageType the ImageTypeSpecifier.
-     * @param param the image's parameters.
-     * @param streamMetadata the stream metadata.
-     * @param imageMetadata the image metadata.
-     * 
-     * @return the number of thumbnails supported
+     * @param imageType
+     *            the ImageTypeSpecifier.
+     * @param param
+     *            the image's parameters.
+     * @param streamMetadata
+     *            the stream metadata.
+     * @param imageMetadata
+     *            the image metadata.
+     * @return the number of thumbnails supported.
      */
-    public int getNumThumbnailsSupported(
-            ImageTypeSpecifier imageType,
-            ImageWriteParam param,
-            IIOMetadata streamMetadata,
-            IIOMetadata imageMetadata
-    ) {
+    public int getNumThumbnailsSupported(ImageTypeSpecifier imageType, ImageWriteParam param,
+            IIOMetadata streamMetadata, IIOMetadata imageMetadata) {
         return 0;
     }
 
     /**
-     * Gets the preferred thumbnail sizes.
-     * Gets an array of Dimensions with the sizes for thumbnail images 
-     * as they are encoded in the output file or stream. 
+     * Gets the preferred thumbnail sizes. Gets an array of Dimensions with the
+     * sizes for thumbnail images as they are encoded in the output file or
+     * stream.
      * 
-     * @param imageType the ImageTypeSpecifier.
-     * @param param the ImageWriteParam.
-     * @param streamMetadata the stream metadata.
-     * @param imageMetadata the image metadata.
-     * 
-     * @return the preferred thumbnail sizes
+     * @param imageType
+     *            the ImageTypeSpecifier.
+     * @param param
+     *            the ImageWriteParam.
+     * @param streamMetadata
+     *            the stream metadata.
+     * @param imageMetadata
+     *            the image metadata.
+     * @return the preferred thumbnail sizes.
      */
-    public Dimension[] getPreferredThumbnailSizes(
-            ImageTypeSpecifier imageType,
-            ImageWriteParam param,
-            IIOMetadata streamMetadata,
-            IIOMetadata imageMetadata
-    ) {
+    public Dimension[] getPreferredThumbnailSizes(ImageTypeSpecifier imageType,
+            ImageWriteParam param, IIOMetadata streamMetadata, IIOMetadata imageMetadata) {
         return null;
     }
 
     /**
-     * Prepares insertion of an empty image by requesting the insertion of 
-     * a new image into an existing image stream.
+     * Prepares insertion of an empty image by requesting the insertion of a new
+     * image into an existing image stream.
      * 
-     * @param imageIndex the image index.
-     * @param imageType the image type.
-     * @param width the width of the image.
-     * @param height the height of the image.
-     * @param imageMetadata the image metadata, or null.
-     * @param thumbnails the array thumbnails for this image, or null.
-     * @param param the ImageWriteParam, or null.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param imageIndex
+     *            the image index.
+     * @param imageType
+     *            the image type.
+     * @param width
+     *            the width of the image.
+     * @param height
+     *            the height of the image.
+     * @param imageMetadata
+     *            the image metadata, or null.
+     * @param thumbnails
+     *            the array thumbnails for this image, or null.
+     * @param param
+     *            the ImageWriteParam, or null.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
-    public void prepareInsertEmpty(
-            int imageIndex, ImageTypeSpecifier imageType,
-            int width, int height,
-            IIOMetadata imageMetadata, List<? extends BufferedImage> thumbnails,
-            ImageWriteParam param
-    ) throws IOException {
+    public void prepareInsertEmpty(int imageIndex, ImageTypeSpecifier imageType, int width,
+            int height, IIOMetadata imageMetadata, List<? extends BufferedImage> thumbnails,
+            ImageWriteParam param) throws IOException {
         unsupportedOperation();
     }
 
     /**
-     * Prepares the writer to call the replacePixels method for the
-     * specified region. 
+     * Prepares the writer to call the replacePixels method for the specified
+     * region.
      * 
-     * @param imageIndex the image's index.
-     * @param region the specified region.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param imageIndex
+     *            the image's index.
+     * @param region
+     *            the specified region.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public void prepareReplacePixels(int imageIndex, Rectangle region) throws IOException {
         unsupportedOperation();
     }
 
     /**
-     * Prepares the writer for writing an empty image by beginning the 
-     * process of writing a complete image stream that contains a single image 
-     * with undefined pixel values, metadata and thumbnails, 
-     * to the output. 
+     * Prepares the writer for writing an empty image by beginning the process
+     * of writing a complete image stream that contains a single image with
+     * undefined pixel values, metadata and thumbnails, to the output.
      * 
-     * @param streamMetadata the stream metadata.
-     * @param imageType the image type.
-     * @param width the width of the image.
-     * @param height the height of the image.
-     * @param imageMetadata the image's metadata, or null.
-     * @param thumbnails the image's thumbnails, or null.
-     * @param param the image's parameters, or null.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param streamMetadata
+     *            the stream metadata.
+     * @param imageType
+     *            the image type.
+     * @param width
+     *            the width of the image.
+     * @param height
+     *            the height of the image.
+     * @param imageMetadata
+     *            the image's metadata, or null.
+     * @param thumbnails
+     *            the image's thumbnails, or null.
+     * @param param
+     *            the image's parameters, or null.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
-    public void prepareWriteEmpty(
-            IIOMetadata streamMetadata, ImageTypeSpecifier imageType,
-            int width, int height,
-            IIOMetadata imageMetadata, List<? extends BufferedImage> thumbnails,
-            ImageWriteParam param
-    ) throws IOException {
+    public void prepareWriteEmpty(IIOMetadata streamMetadata, ImageTypeSpecifier imageType,
+            int width, int height, IIOMetadata imageMetadata,
+            List<? extends BufferedImage> thumbnails, ImageWriteParam param) throws IOException {
         unsupportedOperation();
     }
 
     /**
-     * Prepares a stream to accept calls of writeToSequence method 
-     * using the metadata object. 
+     * Prepares a stream to accept calls of writeToSequence method using the
+     * metadata object.
      * 
-     * @param streamMetadata the stream metadata.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param streamMetadata
+     *            the stream metadata.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public void prepareWriteSequence(IIOMetadata streamMetadata) throws IOException {
         unsupportedOperation();
     }
 
     /**
-     * Processes the completion of a thumbnail read 
-     * by calling their thumbnailComplete method 
-     * of registered IIOWriteProgressListeners. 
+     * Processes the completion of a thumbnail read by calling their
+     * thumbnailComplete method of registered IIOWriteProgressListeners.
      */
     protected void processThumbnailComplete() {
         if (progressListeners != null) {
@@ -730,11 +764,11 @@
     }
 
     /**
-     * Processes the current percentage of thumbnail completion 
-     * by calling their thumbnailProgress method of registered 
-     * IIOWriteProgressListeners.
+     * Processes the current percentage of thumbnail completion by calling their
+     * thumbnailProgress method of registered IIOWriteProgressListeners.
      * 
-     * @param percentageDone the percentage done.
+     * @param percentageDone
+     *            the percentage done.
      */
     protected void processThumbnailProgress(float percentageDone) {
         if (progressListeners != null) {
@@ -745,11 +779,13 @@
     }
 
     /**
-     * Processes the start of a thumbnail read by calling 
-     * thumbnailStarted method of registered IIOWriteProgressListeners. 
+     * Processes the start of a thumbnail read by calling thumbnailStarted
+     * method of registered IIOWriteProgressListeners.
      * 
-     * @param imageIndex the image index.
-     * @param thumbnailIndex the thumbnail index.
+     * @param imageIndex
+     *            the image index.
+     * @param thumbnailIndex
+     *            the thumbnail index.
      */
     protected void processThumbnailStarted(int imageIndex, int thumbnailIndex) {
         if (progressListeners != null) {
@@ -760,7 +796,7 @@
     }
 
     /**
-     * Processes that the writing has been aborted by calling writeAborted 
+     * Processes that the writing has been aborted by calling writeAborted
      * method of registered IIOWriteProgressListeners.
      */
     protected void processWriteAborted() {
@@ -789,8 +825,8 @@
     /**
      * Removes the specified IIOWriteProgressListener listener.
      * 
-     * @param listener the registered IIOWriteProgressListener 
-     * to be removed.
+     * @param listener
+     *            the registered IIOWriteProgressListener to be removed.
      */
     public void removeIIOWriteProgressListener(IIOWriteProgressListener listener) {
         if (progressListeners != null && listener != null) {
@@ -803,8 +839,8 @@
     /**
      * Removes the specified IIOWriteWarningListener listener.
      * 
-     * @param listener the registered IIOWriteWarningListener listener
-     * to be removed.
+     * @param listener
+     *            the registered IIOWriteWarningListener listener to be removed.
      */
     public void removeIIOWriteWarningListener(IIOWriteWarningListener listener) {
         if (warningListeners == null || listener == null) {
@@ -826,9 +862,10 @@
     /**
      * Removes the image with the specified index from the stream.
      * 
-     * @param imageIndex the image's index.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param imageIndex
+     *            the image's index.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public void removeImage(int imageIndex) throws IOException {
         unsupportedOperation();
@@ -837,36 +874,42 @@
     /**
      * Replaces image metadata of the image with specified index.
      * 
-     * @param imageIndex the image's index.
-     * @param imageMetadata the image metadata.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param imageIndex
+     *            the image's index.
+     * @param imageMetadata
+     *            the image metadata.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public void replaceImageMetadata(int imageIndex, IIOMetadata imageMetadata) throws IOException {
         unsupportedOperation();
     }
 
     /**
-     * Replaces a part of an image presented in the output
-     * with the specified RenderedImage.
+     * Replaces a part of an image presented in the output with the specified
+     * RenderedImage.
      * 
-     * @param image the RenderedImage.
-     * @param param the ImageWriteParam.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param image
+     *            the RenderedImage.
+     * @param param
+     *            the ImageWriteParam.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public void replacePixels(RenderedImage image, ImageWriteParam param) throws IOException {
         unsupportedOperation();
     }
 
     /**
-     * Replaces a part of an image presented in the output
-     * with the specified Raster.
+     * Replaces a part of an image presented in the output with the specified
+     * Raster.
      * 
-     * @param raster the Raster.
-     * @param param the ImageWriteParam.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param raster
+     *            the Raster.
+     * @param param
+     *            the ImageWriteParam.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public void replacePixels(Raster raster, ImageWriteParam param) throws IOException {
         unsupportedOperation();
@@ -875,9 +918,10 @@
     /**
      * Replaces the stream metadata of the output with new IIOMetadata.
      * 
-     * @param streamMetadata the new stream metadata.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param streamMetadata
+     *            the new stream metadata.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public void replaceStreamMetadata(IIOMetadata streamMetadata) throws IOException {
         unsupportedOperation();
@@ -886,7 +930,8 @@
     /**
      * Sets the locale of this ImageWriter.
      * 
-     * @param locale the new locale.
+     * @param locale
+     *            the new locale.
      */
     public void setLocale(Locale locale) {
         if (locale == null) {
@@ -924,26 +969,31 @@
     }
 
     /**
-     * Inserts image into existing output stream. 
+     * Inserts image into existing output stream.
      * 
-     * @param imageIndex the image index where an image will be written.
-     * @param image the specified image to be written.
-     * @param param the ImageWriteParam, or null.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param imageIndex
+     *            the image index where an image will be written.
+     * @param image
+     *            the specified image to be written.
+     * @param param
+     *            the ImageWriteParam, or null.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
-    public void writeInsert(int imageIndex, IIOImage image, ImageWriteParam param) throws IOException {
+    public void writeInsert(int imageIndex, IIOImage image, ImageWriteParam param)
+            throws IOException {
         unsupportedOperation();
     }
 
     /**
      * Writes the specified image to the sequence.
      * 
-     * @param image the image to be written.
-     * @param param the ImageWriteParam, or null.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred 
-     * during writting.
+     * @param image
+     *            the image to be written.
+     * @param param
+     *            the ImageWriteParam, or null.
+     * @throws IOException
+     *             if an I/O exception has occurred during writing.
      */
     public void writeToSequence(IIOImage image, ImageWriteParam param) throws IOException {
         unsupportedOperation();
diff --git a/awt/javax/imageio/event/IIOReadProgressListener.java b/awt/javax/imageio/event/IIOReadProgressListener.java
index 3d65807..2944896 100644
--- a/awt/javax/imageio/event/IIOReadProgressListener.java
+++ b/awt/javax/imageio/event/IIOReadProgressListener.java
@@ -18,86 +18,104 @@
  * @author Sergey I. Salishev
  * @version $Revision: 1.2 $
  */
+
 package javax.imageio.event;
 
 import java.util.EventListener;
 import javax.imageio.ImageReader;
 
 /**
- * The IIOReadProgressListener interface notifies callers 
- * about the progress of the image and thumbnail reading methods.
+ * The IIOReadProgressListener interface notifies callers about the progress of
+ * the image and thumbnail reading methods.
+ * 
+ * @since Android 1.0
  */
 public interface IIOReadProgressListener extends EventListener {
 
     /**
-     * Notifies this listener that the image reading has been completed. 
+     * Notifies this listener that the image reading has been completed.
      * 
-     * @param source the ImageReader object which calls this method.
+     * @param source
+     *            the ImageReader object which calls this method.
      */
     void imageComplete(ImageReader source);
-    
+
     /**
      * Notifies this listener about the degree of completion of the read call.
      * 
-     * @param source the ImageReader object which calls this method.
-     * @param percentageDone the percentage of decoding done.
+     * @param source
+     *            the ImageReader object which calls this method.
+     * @param percentageDone
+     *            the percentage of decoding done.
      */
     void imageProgress(ImageReader source, float percentageDone);
-    
+
     /**
-     * Notifies this listener that an image read operation has been started. 
+     * Notifies this listener that an image read operation has been started.
      * 
-     * @param source the ImageReader object which calls this method.
-     * @param imageIndex the index of the image in an input file or 
-     * stream to be read.
+     * @param source
+     *            the ImageReader object which calls this method.
+     * @param imageIndex
+     *            the index of the image in an input file or stream to be read.
      */
     void imageStarted(ImageReader source, int imageIndex);
-    
+
     /**
      * Notifies this listener that a read operation has been aborted.
      * 
-     * @param source the ImageReader object which calls this method.
+     * @param source
+     *            the ImageReader object which calls this method.
      */
     void readAborted(ImageReader source);
-    
+
     /**
-     * Notifies this listener that a sequence of read operations has been completed. 
+     * Notifies this listener that a sequence of read operations has been
+     * completed.
      * 
-     * @param source the ImageReader object which calls this method.
+     * @param source
+     *            the ImageReader object which calls this method.
      */
     void sequenceComplete(ImageReader source);
-    
+
     /**
-     * Notifies this listener that a sequence of read operation has been started. 
+     * Notifies this listener that a sequence of read operation has been
+     * started.
      * 
-     * @param source the ImageReader object which calls this method.
-     * @param minIndex the index of the first image to be read.
+     * @param source
+     *            the ImageReader object which calls this method.
+     * @param minIndex
+     *            the index of the first image to be read.
      */
     void sequenceStarted(ImageReader source, int minIndex);
-    
+
     /**
      * Notifies that a thumbnail read operation has been completed.
      * 
-     * @param source the ImageReader object which calls this method.
+     * @param source
+     *            the ImageReader object which calls this method.
      */
     void thumbnailComplete(ImageReader source);
-    
+
     /**
      * Notifies this listener about the degree of completion of the read call.
      * 
-     * @param source the ImageReader object which calls this method.
-     * @param percentageDone the percentage of decoding done.
+     * @param source
+     *            the ImageReader object which calls this method.
+     * @param percentageDone
+     *            the percentage of decoding done.
      */
     void thumbnailProgress(ImageReader source, float percentageDone);
-    
+
     /**
-     * Notifies this listener that a thumbnail reading operation has been started. 
+     * Notifies this listener that a thumbnail reading operation has been
+     * started.
      * 
-     * @param source the ImageReader object which calls this method.
-     * @param imageIndex the index of the image in an input file or 
-     * stream to be read.
-     * @param thumbnailIndex the index of the thumbnail to be read.
+     * @param source
+     *            the ImageReader object which calls this method.
+     * @param imageIndex
+     *            the index of the image in an input file or stream to be read.
+     * @param thumbnailIndex
+     *            the index of the thumbnail to be read.
      */
     void thumbnailStarted(ImageReader source, int imageIndex, int thumbnailIndex);
 }
-
diff --git a/awt/javax/imageio/event/IIOReadUpdateListener.java b/awt/javax/imageio/event/IIOReadUpdateListener.java
index ce5e2f1..49bdbcb 100644
--- a/awt/javax/imageio/event/IIOReadUpdateListener.java
+++ b/awt/javax/imageio/event/IIOReadUpdateListener.java
@@ -18,6 +18,7 @@
  * @author Sergey I. Salishev
  * @version $Revision: 1.2 $
  */
+
 package javax.imageio.event;
 
 import java.awt.image.BufferedImage;
@@ -30,109 +31,152 @@
  */
 
 /**
- * The IIOReadUpdateListener interface provides functionality 
- * to receive notification of pixel updates during image and thumbnail 
- * reading operations.
+ * The IIOReadUpdateListener interface provides functionality to receive
+ * notification of pixel updates during image and thumbnail reading operations.
+ * 
+ * @since Android 1.0
  */
 public interface IIOReadUpdateListener extends EventListener {
 
     /**
-     * Notifies this listener that the specified area of the image has been updated. 
-     * 
-     * @param source the ImageReader object which calls this method.
-     * @param theImage the image to be updated.
-     * @param minX the minimum X coordinate of the pixels in the updated area.
-     * @param minY the minimum Y coordinate of the pixels in the updated area.
-     * @param width the width of updated area.
-     * @param height the height of updated area.
-     * @param periodX the horizontal spacing period between updated 
-     * pixels, if it equals 1, there is no space between pixels. 
-     * @param periodY the vertical spacing period between updated 
-     * pixels, if it equals 1, there is no space between pixels.
-     * @param bands the array of int values indicating the bands being updated.
-     */
-    void imageUpdate(ImageReader source, BufferedImage theImage, int minX,
-            int minY, int width, int height, int periodX, int periodY,
-            int[] bands);
-    
-    /**
-     * Notifies this listener that the current read operation has completed a 
-     * progressive pass.
-     * 
-     * @param source the ImageReader object which calls this method.
-     * @param theImage the image to be updated.
-     */
-    void passComplete(ImageReader source, BufferedImage theImage);
-    
-    /**
-     * Notifies this listener that the current read operation has begun 
-     * a progressive pass.
-     * 
-     * @param source the ImageReader object which calls this method.
-     * @param theImage the image to be updated.
-     * @param pass the numer of the pass.
-     * @param minPass the index of the first pass that will be decoded.
-     * @param maxPass the index of the last pass that will be decoded.
-     * @param minX the minimum X coordinate of the pixels in the updated area.
-     * @param minY the minimum Y coordinate of the pixels in the updated area.
-     * @param periodX the horizontal spacing period between updated 
-     * pixels, if it equals 1, there is no space between pixels. 
-      * @param periodY the vertical spacing period between updated 
-     * pixels, if it equals 1, there is no space between pixels.
-     * @param bands the array of int values indicating the bands being updated.
-     */
-    void passStarted(ImageReader source, BufferedImage theImage, int pass,
-            int minPass, int maxPass, int minX, int minY, int periodX,
-            int periodY, int[] bands);
-
-    /**
-     * Notifies this listener that the current thumbnail read operation has  
-     * completed a progressive pass.
-     * 
-     * @param source the ImageReader object which calls this method.
-     * @param theImage the thumbnail to be updated.
-     */
-    void thumbnailPassComplete(ImageReader source, BufferedImage theImage);
-    
-    /**
-     * Notifies this listener that the current thumbnail read operation has  
-     * begun a progressive pass.
-     * 
-     * @param source the ImageReader object which calls this method.
-     * @param theThumbnail the thumbnail to be updated.
-     * @param pass the numer of the pass.
-     * @param minPass the index of the first pass that will be decoded.
-     * @param maxPass the index of the last pass that will be decoded.
-     * @param minX the minimum X coordinate of the pixels in the updated area.
-     * @param minY the minimum Y coordinate of the pixels in the updated area.
-     * @param periodX the horizontal spacing period between updated 
-     * pixels, if it equals 1, there is no space between pixels. 
-     * @param periodY the vertical spacing period between updated 
-     * pixels, if it equals 1, there is no space between pixels.
-     * @param bands the array of int values indicating the bands being updated.
-     */
-    void thumbnailPassStarted(ImageReader source, BufferedImage theThumbnail,
-            int pass, int minPass, int maxPass, int minX, int minY,
-            int periodX, int periodY, int[] bands);
-    
-    /**
-     * Notifies this listener that a specified area of a thumbnail image has been 
+     * Notifies this listener that the specified area of the image has been
      * updated.
      * 
-     * @param source the ImageReader object which calls this method.
-     * @param theThumbnail the thumbnail to be updated.
-     * @param minX the minimum X coordinate of the pixels in the updated area.
-     * @param minY the minimum Y coordinate of the pixels in the updated area.
-     * @param width the width of updated area.
-     * @param height the height of updated area.
-     * @param periodX the horizontal spacing period between updated 
-     * pixels, if it equals 1, there is no space between pixels. 
-     * @param periodY the vertical spacing period between updated 
-     * pixels, if it equals 1, there is no space between pixels.
-     * @param bands the array of int values indicating the bands being updated.
+     * @param source
+     *            the ImageReader object which calls this method.
+     * @param theImage
+     *            the image to be updated.
+     * @param minX
+     *            the minimum X coordinate of the pixels in the updated area.
+     * @param minY
+     *            the minimum Y coordinate of the pixels in the updated area.
+     * @param width
+     *            the width of updated area.
+     * @param height
+     *            the height of updated area.
+     * @param periodX
+     *            the horizontal spacing period between updated pixels, if it
+     *            equals 1, there is no space between pixels.
+     * @param periodY
+     *            the vertical spacing period between updated pixels, if it
+     *            equals 1, there is no space between pixels.
+     * @param bands
+     *            the array of integer values indicating the bands being
+     *            updated.
      */
-    void thumbnailUpdate(ImageReader source, BufferedImage theThumbnail,
-            int minX, int minY, int width, int height, int periodX,
-            int periodY, int[] bands);
-}
+    void imageUpdate(ImageReader source, BufferedImage theImage, int minX, int minY, int width,
+            int height, int periodX, int periodY, int[] bands);
 
+    /**
+     * Notifies this listener that the current read operation has completed a
+     * progressive pass.
+     * 
+     * @param source
+     *            the ImageReader object which calls this method.
+     * @param theImage
+     *            the image to be updated.
+     */
+    void passComplete(ImageReader source, BufferedImage theImage);
+
+    /**
+     * Notifies this listener that the current read operation has begun a
+     * progressive pass.
+     * 
+     * @param source
+     *            the ImageReader object which calls this method.
+     * @param theImage
+     *            the image to be updated.
+     * @param pass
+     *            the number of the pass.
+     * @param minPass
+     *            the index of the first pass that will be decoded.
+     * @param maxPass
+     *            the index of the last pass that will be decoded.
+     * @param minX
+     *            the minimum X coordinate of the pixels in the updated area.
+     * @param minY
+     *            the minimum Y coordinate of the pixels in the updated area.
+     * @param periodX
+     *            the horizontal spacing period between updated pixels, if it
+     *            equals 1, there is no space between pixels.
+     * @param periodY
+     *            the vertical spacing period between updated pixels, if it
+     *            equals 1, there is no space between pixels.
+     * @param bands
+     *            the array of integer values indicating the bands being
+     *            updated.
+     */
+    void passStarted(ImageReader source, BufferedImage theImage, int pass, int minPass,
+            int maxPass, int minX, int minY, int periodX, int periodY, int[] bands);
+
+    /**
+     * Notifies this listener that the current thumbnail read operation has
+     * completed a progressive pass.
+     * 
+     * @param source
+     *            the ImageReader object which calls this method.
+     * @param theImage
+     *            the thumbnail to be updated.
+     */
+    void thumbnailPassComplete(ImageReader source, BufferedImage theImage);
+
+    /**
+     * Notifies this listener that the current thumbnail read operation has
+     * begun a progressive pass.
+     * 
+     * @param source
+     *            the ImageReader object which calls this method.
+     * @param theThumbnail
+     *            the thumbnail to be updated.
+     * @param pass
+     *            the number of the pass.
+     * @param minPass
+     *            the index of the first pass that will be decoded.
+     * @param maxPass
+     *            the index of the last pass that will be decoded.
+     * @param minX
+     *            the minimum X coordinate of the pixels in the updated area.
+     * @param minY
+     *            the minimum Y coordinate of the pixels in the updated area.
+     * @param periodX
+     *            the horizontal spacing period between updated pixels, if it
+     *            equals 1, there is no space between pixels.
+     * @param periodY
+     *            the vertical spacing period between updated pixels, if it
+     *            equals 1, there is no space between pixels.
+     * @param bands
+     *            the array of integer values indicating the bands being
+     *            updated.
+     */
+    void thumbnailPassStarted(ImageReader source, BufferedImage theThumbnail, int pass,
+            int minPass, int maxPass, int minX, int minY, int periodX, int periodY, int[] bands);
+
+    /**
+     * Notifies this listener that a specified area of a thumbnail image has
+     * been updated.
+     * 
+     * @param source
+     *            the ImageReader object which calls this method.
+     * @param theThumbnail
+     *            the thumbnail to be updated.
+     * @param minX
+     *            the minimum X coordinate of the pixels in the updated area.
+     * @param minY
+     *            the minimum Y coordinate of the pixels in the updated area.
+     * @param width
+     *            the width of updated area.
+     * @param height
+     *            the height of updated area.
+     * @param periodX
+     *            the horizontal spacing period between updated pixels, if it
+     *            equals 1, there is no space between pixels.
+     * @param periodY
+     *            the vertical spacing period between updated pixels, if it
+     *            equals 1, there is no space between pixels.
+     * @param bands
+     *            the array of integer values indicating the bands being
+     *            updated.
+     */
+    void thumbnailUpdate(ImageReader source, BufferedImage theThumbnail, int minX, int minY,
+            int width, int height, int periodX, int periodY, int[] bands);
+}
diff --git a/awt/javax/imageio/event/IIOReadWarningListener.java b/awt/javax/imageio/event/IIOReadWarningListener.java
index 92fa275..318a5df 100644
--- a/awt/javax/imageio/event/IIOReadWarningListener.java
+++ b/awt/javax/imageio/event/IIOReadWarningListener.java
@@ -18,6 +18,7 @@
  * @author Sergey I. Salishev
  * @version $Revision: 1.2 $
  */
+
 package javax.imageio.event;
 
 import java.util.EventListener;
@@ -29,18 +30,20 @@
  */
 
 /**
- * The IIOReadWarningListener provides methods to receive notification
- * of warning messages generated by image 
- * and thumbnail reading methods.
+ * The IIOReadWarningListener provides methods to receive notification of
+ * warning messages generated by image and thumbnail reading methods.
+ * 
+ * @since Android 1.0
  */
 public interface IIOReadWarningListener extends EventListener {
 
     /**
-     * Notifies this listener about a warning (non-fatal error) during decoding. 
+     * Notifies this listener about a warning (non-fatal error) during decoding.
      * 
-     * @param source the ImageReader object which calls this method.
-     * @param warning the string describing the warning.
+     * @param source
+     *            the ImageReader object which calls this method.
+     * @param warning
+     *            the string describing the warning.
      */
     public void warningOccurred(ImageReader source, String warning);
 }
-
diff --git a/awt/javax/imageio/event/IIOWriteProgressListener.java b/awt/javax/imageio/event/IIOWriteProgressListener.java
index 19ae495..4a2c595 100644
--- a/awt/javax/imageio/event/IIOWriteProgressListener.java
+++ b/awt/javax/imageio/event/IIOWriteProgressListener.java
@@ -18,69 +18,84 @@
  * @author Rustem V. Rafikov
  * @version $Revision: 1.3 $
  */
+
 package javax.imageio.event;
 
 import javax.imageio.ImageWriter;
 import java.util.EventListener;
 
 /**
- * The IIOWriteProgressListener interface provides methods to 
- * receive notification about the progress of the image and 
- * thumbnail writing methods.
+ * The IIOWriteProgressListener interface provides methods to receive
+ * notification about the progress of the image and thumbnail writing methods.
+ * 
+ * @since Android 1.0
  */
 public interface IIOWriteProgressListener extends EventListener {
-    
+
     /**
-     * Notifies this listener that an image write operation has been started. 
+     * Notifies this listener that an image write operation has been started.
      * 
-     * @param source the ImageWriter object which calls this method.
-     * @param imageIndex the index of the image being written.
+     * @param source
+     *            the ImageWriter object which calls this method.
+     * @param imageIndex
+     *            the index of the image being written.
      */
     void imageStarted(ImageWriter source, int imageIndex);
-    
+
     /**
      * Notifies this listener about the degree of completion of the write call.
      * 
-     * @param source the ImageWriter object which calls this method.
-     * @param percentageDone the percentage of encoding done.
+     * @param source
+     *            the ImageWriter object which calls this method.
+     * @param percentageDone
+     *            the percentage of encoding done.
      */
     void imageProgress(ImageWriter source, float percentageDone);
-    
+
     /**
-     * Notifies this listener that the image writing has been completed. 
+     * Notifies this listener that the image writing has been completed.
      * 
-     * @param source the ImageWriter object which calls this method.
+     * @param source
+     *            the ImageWriter object which calls this method.
      */
     void imageComplete(ImageWriter source);
-    
+
     /**
-     * Notifies this listener that a thumbnail write operation has been started. 
+     * Notifies this listener that a thumbnail write operation has been started.
      * 
-     * @param source the ImageWriter object which calls this method.
-     * @param imageIndex the index of the image being written.
-     * @param thumbnailIndex the index of the thumbnail being written.
+     * @param source
+     *            the ImageWriter object which calls this method.
+     * @param imageIndex
+     *            the index of the image being written.
+     * @param thumbnailIndex
+     *            the index of the thumbnail being written.
      */
     void thumbnailStarted(ImageWriter source, int imageIndex, int thumbnailIndex);
-    
+
     /**
      * Notifies this listener about the degree of completion of the write call.
      * 
-     * @param source the ImageWriter object which calls this method.
-     * @param percentageDone the percentage of encoding done.
+     * @param source
+     *            the ImageWriter object which calls this method.
+     * @param percentageDone
+     *            the percentage of encoding done.
      */
     void thumbnailProgress(ImageWriter source, float percentageDone);
-    
+
     /**
-     * Notifies this listener that a thumbnail write operation has been completed.
+     * Notifies this listener that a thumbnail write operation has been
+     * completed.
      * 
-     * @param source the ImageWriter object which calls this method.
+     * @param source
+     *            the ImageWriter object which calls this method.
      */
     void thumbnailComplete(ImageWriter source);
-    
+
     /**
      * Notifies this listener that writing operation has been aborted.
      * 
-     * @param source the ImageWriter object which calls this method.
+     * @param source
+     *            the ImageWriter object which calls this method.
      */
     void writeAborted(ImageWriter source);
 }
diff --git a/awt/javax/imageio/event/IIOWriteWarningListener.java b/awt/javax/imageio/event/IIOWriteWarningListener.java
index f530d25..8ee41cd 100644
--- a/awt/javax/imageio/event/IIOWriteWarningListener.java
+++ b/awt/javax/imageio/event/IIOWriteWarningListener.java
@@ -18,23 +18,29 @@
  * @author Rustem V. Rafikov
  * @version $Revision: 1.3 $
  */
+
 package javax.imageio.event;
 
 import javax.imageio.ImageWriter;
 import java.util.EventListener;
 
 /**
- * The IIOWriteWarningListener provides methods to receive notification
- * of warnings generated by image and thumbnail writing methods.
+ * The IIOWriteWarningListener provides methods to receive notification of
+ * warnings generated by image and thumbnail writing methods.
+ * 
+ * @since Android 1.0
  */
 public interface IIOWriteWarningListener extends EventListener {
-    
+
     /**
-     * Notifies this listener about a warning (non-fatal error) during encoding. 
+     * Notifies this listener about a warning (non-fatal error) during encoding.
      * 
-     * @param source the ImageWriter object which calls this method.
-     * @param imageIndex the index of the image generating the warning.
-     * @param warning the string describing the warning.
+     * @param source
+     *            the ImageWriter object which calls this method.
+     * @param imageIndex
+     *            the index of the image generating the warning.
+     * @param warning
+     *            the string describing the warning.
      */
     void warningOccurred(ImageWriter source, int imageIndex, String warning);
 }
diff --git a/awt/javax/imageio/event/package.html b/awt/javax/imageio/event/package.html
new file mode 100644
index 0000000..c2fe39f
--- /dev/null
+++ b/awt/javax/imageio/event/package.html
@@ -0,0 +1,8 @@
+<html>
+  <body>
+    <p>
+      This package provides interfaces to handle events which can be fired during the reading or writing of images.
+    </p>
+  @since Android 1.0
+  </body>
+</html>
diff --git a/awt/javax/imageio/metadata/IIOInvalidTreeException.java b/awt/javax/imageio/metadata/IIOInvalidTreeException.java
index 8690b2b..ba90657 100644
--- a/awt/javax/imageio/metadata/IIOInvalidTreeException.java
+++ b/awt/javax/imageio/metadata/IIOInvalidTreeException.java
@@ -21,21 +21,26 @@
 import javax.imageio.IIOException;
 
 /**
- * The IIOInvalidTreeException provides notification about
- * fails of IIOMetadataNodes tree parsing by IIOMetadata object. 
+ * The IIOInvalidTreeException provides notification about fails of
+ * IIOMetadataNodes tree parsing by IIOMetadata object.
+ * 
+ * @since Android 1.0
  */
 public class IIOInvalidTreeException extends IIOException {
-    
-    /** The offending node. */
+
+    /**
+     * The offending node.
+     */
     protected Node offendingNode = null;
 
     /**
-     * Instantiates an IIOInvalidTreeException with the
-     * specified detailed message and specified offending
-     * Node.
+     * Instantiates an IIOInvalidTreeException with the specified detailed
+     * message and specified offending Node.
      * 
-     * @param message the detailed message.
-     * @param offendingNode the offending node.
+     * @param message
+     *            the detailed message.
+     * @param offendingNode
+     *            the offending node.
      */
     public IIOInvalidTreeException(String message, Node offendingNode) {
         super(message);
@@ -43,13 +48,15 @@
     }
 
     /**
-     * Instantiates a new IIOInvalidTreeException with the
-     * specified detailed message and specified offending
-     * Node.
+     * Instantiates a new IIOInvalidTreeException with the specified detailed
+     * message and specified offending Node.
      * 
-     * @param message the detailed message.
-     * @param cause the cause of this exception.
-     * @param offendingNode the offending node
+     * @param message
+     *            the detailed message.
+     * @param cause
+     *            the cause of this exception.
+     * @param offendingNode
+     *            the offending node.
      */
     public IIOInvalidTreeException(String message, Throwable cause, Node offendingNode) {
         super(message, cause);
diff --git a/awt/javax/imageio/metadata/IIOMetadata.java b/awt/javax/imageio/metadata/IIOMetadata.java
index f2387cc..96cebf9 100644
--- a/awt/javax/imageio/metadata/IIOMetadata.java
+++ b/awt/javax/imageio/metadata/IIOMetadata.java
@@ -14,6 +14,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
+
 package javax.imageio.metadata;
 
 import java.util.ArrayList;
@@ -22,73 +23,90 @@
 import org.w3c.dom.Node;
 
 /**
- * The Class IIOMetadata represents the metadata (bundled with an image)
- * as a Dom-type tree.
+ * The class IIOMetadata represents the metadata (bundled with an image) as a
+ * Dom-type tree.
+ * 
+ * @since Android 1.0
  */
 public abstract class IIOMetadata {
 
-    /** Whether the standard metadata format is supported. */
+    /**
+     * Whether the standard metadata format is supported.
+     */
     protected boolean standardFormatSupported;
-    
-    /** The native metadata format name. */
+
+    /**
+     * The native metadata format name.
+     */
     protected String nativeMetadataFormatName;
-    
-    /** The native metadata format class name. */
+
+    /**
+     * The native metadata format class name.
+     */
     protected String nativeMetadataFormatClassName;
-    
-    /** The extra metadata format names. */
+
+    /**
+     * The extra metadata format names.
+     */
     protected String[] extraMetadataFormatNames;
-    
-    /** The extra metadata format class names. */
+
+    /**
+     * The extra metadata format class names.
+     */
     protected String[] extraMetadataFormatClassNames;
-    
-    /** The default controller. */
+
+    /**
+     * The default controller.
+     */
     protected IIOMetadataController defaultController;
-    
-    /** The controller. */
+
+    /**
+     * The controller.
+     */
     protected IIOMetadataController controller;
 
     /**
      * Instantiates a new IIOMetadata with no data set.
      */
-    protected IIOMetadata() {}
+    protected IIOMetadata() {
+    }
 
     /**
      * Instantiates a new IIOMetadata with the specified data parameters.
      * 
-     * @param standardMetadataFormatSupported whether the standard metadata format is supported
-     * @param nativeMetadataFormatName the native metadata format name
-     * @param nativeMetadataFormatClassName the native metadata format class name
-     * @param extraMetadataFormatNames the extra metadata format names
-     * @param extraMetadataFormatClassNames the extra metadata format class names
+     * @param standardMetadataFormatSupported
+     *            whether the standard metadata format is supported.
+     * @param nativeMetadataFormatName
+     *            the native metadata format name.
+     * @param nativeMetadataFormatClassName
+     *            the native metadata format class name.
+     * @param extraMetadataFormatNames
+     *            the extra metadata format names.
+     * @param extraMetadataFormatClassNames
+     *            the extra metadata format class names.
      */
-    protected IIOMetadata(boolean standardMetadataFormatSupported,
-                          String nativeMetadataFormatName,
-                          String nativeMetadataFormatClassName,
-                          String[] extraMetadataFormatNames,
-                          String[] extraMetadataFormatClassNames) {
+    protected IIOMetadata(boolean standardMetadataFormatSupported, String nativeMetadataFormatName,
+            String nativeMetadataFormatClassName, String[] extraMetadataFormatNames,
+            String[] extraMetadataFormatClassNames) {
         standardFormatSupported = standardMetadataFormatSupported;
         this.nativeMetadataFormatName = nativeMetadataFormatName;
         this.nativeMetadataFormatClassName = nativeMetadataFormatClassName;
         if (extraMetadataFormatNames == null) {
             if (extraMetadataFormatClassNames != null) {
                 throw new IllegalArgumentException(
-                        "extraMetadataFormatNames == null && extraMetadataFormatClassNames != null!"
-                );
+                        "extraMetadataFormatNames == null && extraMetadataFormatClassNames != null!");
             }
         } else {
             if (extraMetadataFormatClassNames == null) {
                 throw new IllegalArgumentException(
-                        "extraMetadataFormatNames != null && extraMetadataFormatClassNames == null!"
-                );
+                        "extraMetadataFormatNames != null && extraMetadataFormatClassNames == null!");
             }
             if (extraMetadataFormatNames.length == 0) {
                 throw new IllegalArgumentException("extraMetadataFormatNames.length == 0!");
             }
             if (extraMetadataFormatClassNames.length != extraMetadataFormatNames.length) {
                 throw new IllegalArgumentException(
-                        "extraMetadataFormatClassNames.length != extraMetadataFormatNames.length!"
-                );
+                        "extraMetadataFormatClassNames.length != extraMetadataFormatNames.length!");
             }
             this.extraMetadataFormatNames = extraMetadataFormatNames.clone();
             this.extraMetadataFormatClassNames = extraMetadataFormatClassNames.clone();
@@ -98,30 +116,32 @@
     /**
      * Gets the metadata as tree-type document.
      * 
-     * @param formatName the format name
-     * 
-     * @return the node in tree format
+     * @param formatName
+     *            the format name.
+     * @return the node in tree format.
      */
     public abstract Node getAsTree(String formatName);
-    
+
     /**
      * Checks if the metadata is read only.
      * 
      * @return true, if the metadata is read only.
      */
     public abstract boolean isReadOnly();
-    
+
     /**
      * Merges the specified tree with this metadata tree.
      * 
-     * @param formatName the format of the specified tree
-     * @param root the root node of the metadata tree
-     * 
-     * @throws IIOInvalidTreeException if the specified tree
-     * is incompatible with the this metadata tree.
+     * @param formatName
+     *            the format of the specified tree.
+     * @param root
+     *            the root node of the metadata tree.
+     * @throws IIOInvalidTreeException
+     *             if the specified tree is incompatible with the this metadata
+     *             tree.
      */
     public abstract void mergeTree(String formatName, Node root) throws IIOInvalidTreeException;
-    
+
     /**
      * Resets the controller.
      */
@@ -130,7 +150,7 @@
     /**
      * Gets the controller associated with this metadata document.
      * 
-     * @return the controller
+     * @return the controller.
      */
     public IIOMetadataController getController() {
         return controller;
@@ -139,7 +159,7 @@
     /**
      * Checks whether this metadata has a controller.
      * 
-     * @return true, if this metadata has a controller
+     * @return true, if this metadata has a controller.
      */
     public boolean hasController() {
         return getController() != null;
@@ -148,7 +168,7 @@
     /**
      * Activate the controller.
      * 
-     * @return true, if successful
+     * @return true, if successful.
      */
     public boolean activateController() {
         if (!hasController()) {
@@ -160,7 +180,7 @@
     /**
      * Gets the default controller.
      * 
-     * @return the default controller
+     * @return the default controller.
      */
     public IIOMetadataController getDefaultController() {
         return defaultController;
@@ -169,7 +189,7 @@
     /**
      * Gets the extra metadata format names.
      * 
-     * @return the extra metadata format names
+     * @return the extra metadata format names.
      */
     public String[] getExtraMetadataFormatNames() {
         return extraMetadataFormatNames == null ? null : extraMetadataFormatNames.clone();
@@ -178,23 +198,20 @@
     /**
      * Gets the metadata format.
      * 
-     * @param formatName the format name
-     * 
-     * @return the metadata format
+     * @param formatName
+     *            the format name.
+     * @return the metadata format.
      */
     public IIOMetadataFormat getMetadataFormat(String formatName) {
-        return IIOMetadataUtils.instantiateMetadataFormat(
-                formatName,
-                standardFormatSupported,
-                nativeMetadataFormatName, nativeMetadataFormatClassName,
-                extraMetadataFormatNames, extraMetadataFormatClassNames
-        );
+        return IIOMetadataUtils.instantiateMetadataFormat(formatName, standardFormatSupported,
+                nativeMetadataFormatName, nativeMetadataFormatClassName, extraMetadataFormatNames,
+                extraMetadataFormatClassNames);
     }
 
     /**
      * Gets the native metadata format name.
      * 
-     * @return the native metadata format name
+     * @return the native metadata format name.
      */
     public String getNativeMetadataFormatName() {
         return nativeMetadataFormatName;
@@ -203,7 +220,7 @@
     /**
      * Checks if the standard metadata format is supported.
      * 
-     * @return true, if the standard metadata format is supported
+     * @return true, if the standard metadata format is supported.
      */
     public boolean isStandardMetadataFormatSupported() {
         return standardFormatSupported;
@@ -212,7 +229,7 @@
     /**
      * Gets the metadata format names.
      * 
-     * @return the metadata format names
+     * @return the metadata format names.
      */
     public String[] getMetadataFormatNames() {
         ArrayList<String> res = new ArrayList<String>();
@@ -239,7 +256,7 @@
     /**
      * Gets the standard chroma node.
      * 
-     * @return the standard chroma node
+     * @return the standard chroma node.
      */
     protected IIOMetadataNode getStandardChromaNode() {
         return null;
@@ -248,7 +265,7 @@
     /**
      * Gets the standard compression node.
      * 
-     * @return the standard compression node
+     * @return the standard compression node.
      */
     protected IIOMetadataNode getStandardCompressionNode() {
         return null;
@@ -257,7 +274,7 @@
     /**
      * Gets the standard data node.
      * 
-     * @return the standard data node
+     * @return the standard data node.
      */
     protected IIOMetadataNode getStandardDataNode() {
         return null;
@@ -266,7 +283,7 @@
     /**
      * Gets the standard dimension node.
      * 
-     * @return the standard dimension node
+     * @return the standard dimension node.
      */
     protected IIOMetadataNode getStandardDimensionNode() {
         return null;
@@ -275,7 +292,7 @@
     /**
      * Gets the standard document node.
      * 
-     * @return the standard document node
+     * @return the standard document node.
      */
     protected IIOMetadataNode getStandardDocumentNode() {
         return null;
@@ -284,7 +301,7 @@
     /**
      * Gets the standard text node.
      * 
-     * @return the standard text node
+     * @return the standard text node.
      */
     protected IIOMetadataNode getStandardTextNode() {
         return null;
@@ -293,7 +310,7 @@
     /**
      * Gets the standard tile node.
      * 
-     * @return the standard tile node
+     * @return the standard tile node.
      */
     protected IIOMetadataNode getStandardTileNode() {
         return null;
@@ -302,7 +319,7 @@
     /**
      * Gets the standard transparency node.
      * 
-     * @return the standard transparency node
+     * @return the standard transparency node.
      */
     protected IIOMetadataNode getStandardTransparencyNode() {
         return null;
@@ -311,7 +328,7 @@
     /**
      * Gets the metadata as a tree in standard format.
      * 
-     * @return the metadata as a tree in standard format
+     * @return the metadata as a tree in standard format.
      */
     protected final IIOMetadataNode getStandardTree() {
         // Create root node
@@ -342,14 +359,15 @@
         if ((node = getStandardTransparencyNode()) != null) {
             root.appendChild(node);
         }
-        
+
         return root;
     }
 
     /**
      * Sets the controller.
      * 
-     * @param controller the new controller
+     * @param controller
+     *            the new controller.
      */
     public void setController(IIOMetadataController controller) {
         this.controller = controller;
@@ -358,11 +376,13 @@
     /**
      * Sets the from tree.
      * 
-     * @param formatName the name of the metatdata format of the from tree
-     * @param root the root node of the from tree
-     * 
-     * @throws IIOInvalidTreeException if the tree or its format is not compatible with 
-     * this metadata.
+     * @param formatName
+     *            the name of the metatdata format of the from tree.
+     * @param root
+     *            the root node of the from tree.
+     * @throws IIOInvalidTreeException
+     *             if the tree or its format is not compatible with this
+     *             metadata.
      */
     public void setFromTree(String formatName, Node root) throws IIOInvalidTreeException {
         reset();
diff --git a/awt/javax/imageio/metadata/IIOMetadataController.java b/awt/javax/imageio/metadata/IIOMetadataController.java
index dfd4e5c..1405948 100644
--- a/awt/javax/imageio/metadata/IIOMetadataController.java
+++ b/awt/javax/imageio/metadata/IIOMetadataController.java
@@ -18,6 +18,7 @@
  * @author Sergey I. Salishev
  * @version $Revision: 1.2 $
  */
+
 package javax.imageio.metadata;
 
 /* 
@@ -26,20 +27,20 @@
  */
 
 /**
- * The IIOMetadataController interface provides a method for 
- * implementing objects to activate the controller without 
- * defining how the controller obtains values.
+ * The IIOMetadataController interface provides a method for implementing
+ * objects to activate the controller without defining how the controller
+ * obtains values.
+ * 
+ * @since Android 1.0
  */
 public interface IIOMetadataController {
 
     /**
      * Activates a controller.
      * 
-     * @param metadata the metadata to be modified.
-     * 
-     * @return true if the IIOMetadata has been modified, 
-     * false otherwise.
+     * @param metadata
+     *            the metadata to be modified.
+     * @return true, if the IIOMetadata has been modified, false otherwise.
      */
     public boolean activate(IIOMetadata metadata);
 }
-
diff --git a/awt/javax/imageio/metadata/IIOMetadataFormat.java b/awt/javax/imageio/metadata/IIOMetadataFormat.java
index 9e246b4..0e7e697 100644
--- a/awt/javax/imageio/metadata/IIOMetadataFormat.java
+++ b/awt/javax/imageio/metadata/IIOMetadataFormat.java
@@ -21,327 +21,384 @@
 import java.util.Locale;
 
 /**
- * The Interface IIOMetadataFormat is implemented by classes that 
- * describe the rules and allowed elements for a metadata document
- * tree.
+ * The Interface IIOMetadataFormat is implemented by classes that describe the
+ * rules and allowed elements for a metadata document tree.
+ * 
+ * @since Android 1.0
  */
 public interface IIOMetadataFormat {
 
-    /** The CHILD_POLICY_EMPTY. */
+    /**
+     * The CHILD_POLICY_EMPTY.
+     */
     int CHILD_POLICY_EMPTY = 0;
-    
-    /** The CHILD_POLICY_ALL. */
-    int CHILD_POLICY_ALL = 1;
-    
-    /** The CHILD_POLICY_SOME. */
-    int CHILD_POLICY_SOME = 2;
-    
-    /** The CHILD_POLICY_CHOICE. */
-    int CHILD_POLICY_CHOICE = 3;
-    
-    /** The CHILD_POLICY_SEQUENCE. */
-    int CHILD_POLICY_SEQUENCE = 4;
-    
-    /** The CHILD_POLICY_REPEAT. */
-    int CHILD_POLICY_REPEAT = 5;
-    
-    /** The maximum value for the child policy. */
-    int CHILD_POLICY_MAX = CHILD_POLICY_REPEAT;
-
-    /** The DATATYPE_STRING. */
-    int DATATYPE_STRING = 0;
-    
-    /** The DATATYPE_BOOLEAN. */
-    int DATATYPE_BOOLEAN = 1;
-    
-    /** The DATATYPE_INTEGER. */
-    int DATATYPE_INTEGER = 2;
-    
-    /** The DATATYPE_FLOAT. */
-    int DATATYPE_FLOAT = 3;
-    
-    /** The DATATYPE_DOUBLE. */
-    int DATATYPE_DOUBLE = 4;
-
-    /** The VALUE_NONE. */
-    int VALUE_NONE = 0;
-    
-    /** The VALUE_ARBITRARY. */
-    int VALUE_ARBITRARY = 1;
-    
-    /** The VALUE_RANGE. */
-    int VALUE_RANGE = 2;
-    
-    /** The VALUE_RANGE_MIN_INCLUSIVE_MASK. */
-    int VALUE_RANGE_MIN_INCLUSIVE_MASK = 4;
-    
-    /** The VALUE_RANGE_MAX_INCLUSIVE_MASK. */
-    int VALUE_RANGE_MAX_INCLUSIVE_MASK = 8;
-    
-    /** The VALUE_ENUMERATION. */
-    int VALUE_ENUMERATION = 16;
-    
-    /** The VALUE_LIST. */
-    int VALUE_LIST = 32;
-    
-    /** The VALUE_RANGE_MIN_INCLUSIVE. */
-    int VALUE_RANGE_MIN_INCLUSIVE = VALUE_RANGE | VALUE_RANGE_MIN_INCLUSIVE_MASK;
-    
-    /** The VALUE_RANGE_MAX_INCLUSIVE. */
-    int VALUE_RANGE_MAX_INCLUSIVE = VALUE_RANGE | VALUE_RANGE_MAX_INCLUSIVE_MASK;
-    
-    /** The VALUE_RANGE_MIN_MAX_INCLUSIVE. */
-    int VALUE_RANGE_MIN_MAX_INCLUSIVE =
-            VALUE_RANGE | VALUE_RANGE_MIN_INCLUSIVE_MASK | VALUE_RANGE_MAX_INCLUSIVE_MASK;
 
     /**
-     * Tells whether the specified element is allowed for the specified 
-     * image type.
+     * The CHILD_POLICY_ALL.
+     */
+    int CHILD_POLICY_ALL = 1;
+
+    /**
+     * The CHILD_POLICY_SOME.
+     */
+    int CHILD_POLICY_SOME = 2;
+
+    /**
+     * The CHILD_POLICY_CHOICE.
+     */
+    int CHILD_POLICY_CHOICE = 3;
+
+    /**
+     * The CHILD_POLICY_SEQUENCE.
+     */
+    int CHILD_POLICY_SEQUENCE = 4;
+
+    /**
+     * The CHILD_POLICY_REPEAT.
+     */
+    int CHILD_POLICY_REPEAT = 5;
+
+    /**
+     * The maximum value for the child policy.
+     */
+    int CHILD_POLICY_MAX = CHILD_POLICY_REPEAT;
+
+    /**
+     * The DATATYPE_STRING.
+     */
+    int DATATYPE_STRING = 0;
+
+    /**
+     * The DATATYPE_BOOLEAN.
+     */
+    int DATATYPE_BOOLEAN = 1;
+
+    /**
+     * The DATATYPE_INTEGER.
+     */
+    int DATATYPE_INTEGER = 2;
+
+    /**
+     * The DATATYPE_FLOAT.
+     */
+    int DATATYPE_FLOAT = 3;
+
+    /**
+     * The DATATYPE_DOUBLE.
+     */
+    int DATATYPE_DOUBLE = 4;
+
+    /**
+     * The VALUE_NONE.
+     */
+    int VALUE_NONE = 0;
+
+    /**
+     * The VALUE_ARBITRARY.
+     */
+    int VALUE_ARBITRARY = 1;
+
+    /**
+     * The VALUE_RANGE.
+     */
+    int VALUE_RANGE = 2;
+
+    /**
+     * The VALUE_RANGE_MIN_INCLUSIVE_MASK.
+     */
+    int VALUE_RANGE_MIN_INCLUSIVE_MASK = 4;
+
+    /**
+     * The VALUE_RANGE_MAX_INCLUSIVE_MASK.
+     */
+    int VALUE_RANGE_MAX_INCLUSIVE_MASK = 8;
+
+    /**
+     * The VALUE_ENUMERATION.
+     */
+    int VALUE_ENUMERATION = 16;
+
+    /**
+     * The VALUE_LIST.
+     */
+    int VALUE_LIST = 32;
+
+    /**
+     * The VALUE_RANGE_MIN_INCLUSIVE.
+     */
+    int VALUE_RANGE_MIN_INCLUSIVE = VALUE_RANGE | VALUE_RANGE_MIN_INCLUSIVE_MASK;
+
+    /**
+     * The VALUE_RANGE_MAX_INCLUSIVE.
+     */
+    int VALUE_RANGE_MAX_INCLUSIVE = VALUE_RANGE | VALUE_RANGE_MAX_INCLUSIVE_MASK;
+
+    /**
+     * The VALUE_RANGE_MIN_MAX_INCLUSIVE.
+     */
+    int VALUE_RANGE_MIN_MAX_INCLUSIVE = VALUE_RANGE | VALUE_RANGE_MIN_INCLUSIVE_MASK
+            | VALUE_RANGE_MAX_INCLUSIVE_MASK;
+
+    /**
+     * Tells whether the specified element is allowed for the specified image
+     * type.
      * 
-     * @param elementName the element name
-     * @param imageType the image type
-     * 
-     * @return true, if the specified element is allowed for the specified 
-     * image type
+     * @param elementName
+     *            the element name.
+     * @param imageType
+     *            the image type.
+     * @return true, if the specified element is allowed for the specified image
+     *         type.
      */
     boolean canNodeAppear(String elementName, ImageTypeSpecifier imageType);
 
     /**
      * Gets data type of the specified attribute of the specified element.
      * 
-     * @param elementName the element name
-     * @param attrName the attribute name
-     * 
-     * @return the attribute's data type
+     * @param elementName
+     *            the element name.
+     * @param attrName
+     *            the attribute name.
+     * @return the attribute's data type.
      */
     int getAttributeDataType(String elementName, String attrName);
-    
+
     /**
-     * Gets the default value of the specified attribute of the specified element.
+     * Gets the default value of the specified attribute of the specified
+     * element.
      * 
-     * @param elementName the element name
-     * @param attrName the attribute name
-     * 
-     * @return the attribute's default value
+     * @param elementName
+     *            the element name.
+     * @param attrName
+     *            the attribute name.
+     * @return the attribute's default value.
      */
     String getAttributeDefaultValue(String elementName, String attrName);
-    
+
     /**
      * Gets the user-friendly description of the attribute.
      * 
-     * @param elementName the element name
-     * @param attrName the attribute name
-     * @param locale the locale giving the desired language for the
-     * description
-     * 
-     * @return the attribute description
+     * @param elementName
+     *            the element name.
+     * @param attrName
+     *            the attribute name.
+     * @param locale
+     *            the locale giving the desired language for the description.
+     * @return the attribute description.
      */
     String getAttributeDescription(String elementName, String attrName, Locale locale);
-    
+
     /**
      * Gets the attribute enumerations.
      * 
-     * @param elementName the element name
-     * @param attrName the attribute name
-     * 
-     * @return the attribute enumerations
+     * @param elementName
+     *            the element name.
+     * @param attrName
+     *            the attribute name.
+     * @return the attribute enumerations.
      */
     String[] getAttributeEnumerations(String elementName, String attrName);
-    
+
     /**
      * Gets the maximum length of the attribute list.
      * 
-     * @param elementName the element name
-     * @param attrName the attribute name
-     * 
-     * @return the maximum length of the attribute list
+     * @param elementName
+     *            the element name.
+     * @param attrName
+     *            the attribute name.
+     * @return the maximum length of the attribute list.
      */
     int getAttributeListMaxLength(String elementName, String attrName);
-    
+
     /**
      * Gets the minimum length of the attribute list.
      * 
-     * @param elementName the element name
-     * @param attrName the attribute name
-     * 
-     * @return the minimum length of the attribute list
+     * @param elementName
+     *            the element name.
+     * @param attrName
+     *            the attribute name.
+     * @return the minimum length of the attribute list.
      */
     int getAttributeListMinLength(String elementName, String attrName);
-    
+
     /**
      * Gets the maximum value allowed for the attribute.
      * 
-     * @param elementName the element name
-     * @param attrName the attribute name
-     * 
-     * @return the maximum value allowed for the attribute
+     * @param elementName
+     *            the element name.
+     * @param attrName
+     *            the attribute name.
+     * @return the maximum value allowed for the attribute.
      */
     String getAttributeMaxValue(String elementName, String attrName);
-    
+
     /**
      * Gets the minimum value allowed for the attribute.
      * 
-     * @param elementName the element name
-     * @param attrName the attribute name
-     * 
-     * @return the minimum value allowed for the attribute
+     * @param elementName
+     *            the element name.
+     * @param attrName
+     *            the attribute name.
+     * @return the minimum value allowed for the attribute.
      */
     String getAttributeMinValue(String elementName, String attrName);
-    
+
     /**
      * Gets the attribute names allowed for the specified element.
      * 
-     * @param elementName the element name
-     * 
-     * @return the attribute names
+     * @param elementName
+     *            the element name.
+     * @return the attribute names.
      */
     String[] getAttributeNames(String elementName);
-    
+
     /**
      * Gets the attribute value type.
      * 
-     * @param elementName the element name
-     * @param attrName the attribute name
-     * 
-     * @return the attribute value type
+     * @param elementName
+     *            the element name.
+     * @param attrName
+     *            the attribute name.
+     * @return the attribute value type.
      */
     int getAttributeValueType(String elementName, String attrName);
-    
+
     /**
-     * Checks whether the specified attribute is required 
-     * for the specified element.
+     * Checks whether the specified attribute is required for the specified
+     * element.
      * 
-     * @param elementName the element name
-     * @param attrName the attribute name
-     * 
-     * @return true, if the specified attribute is required for the 
-     * specified element
+     * @param elementName
+     *            the element name.
+     * @param attrName
+     *            the attribute name.
+     * @return true, if the specified attribute is required for the specified
+     *         element.
      */
     boolean isAttributeRequired(String elementName, String attrName);
 
     /**
      * Gets the names of the possible child elements for the given element.
      * 
-     * @param elementName the element name
-     * 
-     * @return the child names
+     * @param elementName
+     *            the element name.
+     * @return the child names.
      */
     String[] getChildNames(String elementName);
-    
+
     /**
      * Gets the constant describing the element's child policy.
      * 
-     * @param elementName the element name
-     * 
-     * @return the child policy
+     * @param elementName
+     *            the element name.
+     * @return the child policy.
      */
     int getChildPolicy(String elementName);
 
     /**
      * Gets the user-friendly description of the element.
      * 
-     * @param elementName the element name
-     * @param locale the locale giving the desired language for the
-     * description
-     * 
-     * @return the element description
+     * @param elementName
+     *            the element name.
+     * @param locale
+     *            the locale giving the desired language for the description.
+     * @return the element description.
      */
     String getElementDescription(String elementName, Locale locale);
-    
+
     /**
      * Gets the maximum number of children allowed for the element.
      * 
-     * @param elementName the element name
-     * 
-     * @return the maximum number of children allowed for the element
+     * @param elementName
+     *            the element name.
+     * @return the maximum number of children allowed for the element.
      */
     int getElementMaxChildren(String elementName);
-    
+
     /**
      * Gets the minimum number of children allowed for the element.
      * 
-     * @param elementName the element name
-     * 
-     * @return the minimum number of children allowed for the element
+     * @param elementName
+     *            the element name.
+     * @return the minimum number of children allowed for the element.
      */
     int getElementMinChildren(String elementName);
 
     /**
      * Gets the maximum object array length allowed for the element.
      * 
-     * @param elementName the element name
-     * 
-     * @return the maximum object array length allowed for the element
+     * @param elementName
+     *            the element name.
+     * @return the maximum object array length allowed for the element.
      */
     int getObjectArrayMaxLength(String elementName);
-    
+
     /**
      * Gets the minimum object array length allowed for the element.
      * 
-     * @param elementName the element name
-     * 
-     * @return the minimum object array length allowed for the element
+     * @param elementName
+     *            the element name.
+     * @return the minimum object array length allowed for the element.
      */
     int getObjectArrayMinLength(String elementName);
-    
+
     /**
      * Gets the object class corresponding to the specified element.
      * 
-     * @param elementName the element name
-     * 
-     * @return the object class corresponding to the specified element
+     * @param elementName
+     *            the element name.
+     * @return the object class corresponding to the specified element.
      */
     Class<?> getObjectClass(String elementName);
-    
+
     /**
      * Gets the object default value for the element.
      * 
-     * @param elementName the element name
-     * 
-     * @return the object default value for the element
+     * @param elementName
+     *            the element name.
+     * @return the object default value for the element.
      */
     Object getObjectDefaultValue(String elementName);
-    
+
     /**
      * Gets the object enumerations.
      * 
-     * @param elementName the element name
-     * 
-     * @return the object enumerations
+     * @param elementName
+     *            the element name.
+     * @return the object enumerations.
      */
     Object[] getObjectEnumerations(String elementName);
-    
+
     /**
      * Gets the maximum value allowed for the element's object.
      * 
-     * @param elementName the element name
-     * 
-     * @return the maximum value allowed for the element's object
+     * @param elementName
+     *            the element name.
+     * @return the maximum value allowed for the element's object.
      */
     Comparable<?> getObjectMaxValue(String elementName);
-    
+
     /**
      * Gets the minimum value allowed for the element's object.
      * 
-     * @param elementName the element name
-     * 
-     * @return the minimum value allowed for the element's object
+     * @param elementName
+     *            the element name.
+     * @return the minimum value allowed for the element's object.
      */
     Comparable<?> getObjectMinValue(String elementName);
-    
+
     /**
      * Gets the constant that indicates the type of the element's value.
      * 
-     * @param elementName the element name
-     * 
-     * @return the constant that indicates the type of the element's value
+     * @param elementName
+     *            the element name.
+     * @return the constant that indicates the type of the element's value.
      */
     int getObjectValueType(String elementName);
 
     /**
      * Gets the name of the root element.
      * 
-     * @return the name of the root element
+     * @return the name of the root element.
      */
     String getRootName();
 }
diff --git a/awt/javax/imageio/metadata/IIOMetadataFormatImpl.java b/awt/javax/imageio/metadata/IIOMetadataFormatImpl.java
index 438ae90..1a6e568 100644
--- a/awt/javax/imageio/metadata/IIOMetadataFormatImpl.java
+++ b/awt/javax/imageio/metadata/IIOMetadataFormatImpl.java
@@ -23,45 +23,60 @@
 import java.security.PrivilegedAction;
 
 /**
- * The IIOMetadataFormatImpl class provides an implementation of the 
+ * The IIOMetadataFormatImpl class provides an implementation of the
  * IIOMetadataFormat interface.
+ * 
+ * @since Android 1.0
  */
 public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat {
-    
-    /** The Constant standardMetadataFormatName. */
-    @SuppressWarnings({"ConstantDeclaredInAbstractClass"})
+
+    /**
+     * The Constant standardMetadataFormatName.
+     */
+    @SuppressWarnings( {
+        "ConstantDeclaredInAbstractClass"
+    })
     public static final String standardMetadataFormatName = "javax_imageio_1.0";
 
-    /** The standard format. */
-    @SuppressWarnings({"StaticNonFinalField"})
+    /**
+     * The standard format.
+     */
+    @SuppressWarnings( {
+        "StaticNonFinalField"
+    })
     private static IIOMetadataFormatImpl standardFormat;
 
-    /** The root name. */
+    /**
+     * The root name.
+     */
     private String rootName;
-    
-    /** The element hash. */
+
+    /**
+     * The element hash.
+     */
     private HashMap<String, Element> elementHash = new HashMap<String, Element>();
 
-    /** The resource base name. */
+    /**
+     * The resource base name.
+     */
     private String resourceBaseName = getClass().getName() + "Resources";
 
     /**
-     * Instantiates an IIOMetadataFormatImpl with the specified root
-     * name and child policy (not CHILD_POLICY_REPEAT).
+     * Instantiates an IIOMetadataFormatImpl with the specified root name and
+     * child policy (not CHILD_POLICY_REPEAT).
      * 
-     * @param rootName the name of root element.
-     * @param childPolicy the child policy defined by one of the 
-     * CHILD_POLICY_* constants  (except CHILD_POLICY_REPEAT).
+     * @param rootName
+     *            the name of root element.
+     * @param childPolicy
+     *            the child policy defined by one of the CHILD_POLICY_*
+     *            constants (except CHILD_POLICY_REPEAT).
      */
     public IIOMetadataFormatImpl(String rootName, int childPolicy) {
         if (rootName == null) {
             throw new IllegalArgumentException("rootName is null");
         }
-        if (
-                childPolicy < CHILD_POLICY_EMPTY ||
-                childPolicy > CHILD_POLICY_MAX ||
-                childPolicy == CHILD_POLICY_REPEAT
-        ) {
+        if (childPolicy < CHILD_POLICY_EMPTY || childPolicy > CHILD_POLICY_MAX
+                || childPolicy == CHILD_POLICY_REPEAT) {
             throw new IllegalArgumentException("childPolicy is not one of the predefined constants");
         }
 
@@ -73,12 +88,15 @@
     }
 
     /**
-     * Instantiates an IIOMetadataFormatImpl with the specified root
-     * name and CHILD_POLICY_REPEAT child policy.
+     * Instantiates an IIOMetadataFormatImpl with the specified root name and
+     * CHILD_POLICY_REPEAT child policy.
      * 
-     * @param rootName the name of root element.
-     * @param minChildren the minimum number of children.
-     * @param maxChildren the maximum number of children
+     * @param rootName
+     *            the name of root element.
+     * @param minChildren
+     *            the minimum number of children.
+     * @param maxChildren
+     *            the maximum number of children
      */
     public IIOMetadataFormatImpl(String rootName, int minChildren, int maxChildren) {
         if (rootName == null) {
@@ -100,25 +118,31 @@
         elementHash.put(rootName, root);
     }
 
-    @SuppressWarnings({"AbstractMethodOverridesAbstractMethod"})
+    @SuppressWarnings( {
+        "AbstractMethodOverridesAbstractMethod"
+    })
     public abstract boolean canNodeAppear(String elementName, ImageTypeSpecifier imageType);
 
     /**
      * Adds a new attribute to an existing element.
      * 
-     * @param elementName the name of the element to which the new attribute
-     * will be added.
-     * @param attrName the attribute name.
-     * @param dataType the data type of the new attribute.
-     * @param required the flag which indicates whether this attribute
-     * must be present.
-     * @param listMinLength the minimum legal number of list items.
-     * @param listMaxLength the the maximum legal number of list items.
+     * @param elementName
+     *            the name of the element to which the new attribute will be
+     *            added.
+     * @param attrName
+     *            the attribute name.
+     * @param dataType
+     *            the data type of the new attribute.
+     * @param required
+     *            the flag which indicates whether this attribute must be
+     *            present.
+     * @param listMinLength
+     *            the minimum legal number of list items.
+     * @param listMaxLength
+     *            the the maximum legal number of list items.
      */
-    protected void addAttribute(
-            String elementName, String attrName, int dataType,
-            boolean required, int listMinLength, int listMaxLength
-    ) {
+    protected void addAttribute(String elementName, String attrName, int dataType,
+            boolean required, int listMinLength, int listMaxLength) {
         if (attrName == null) {
             throw new IllegalArgumentException("attrName == null!");
         }
@@ -144,18 +168,21 @@
     /**
      * Adds a new attribute to an existing element.
      * 
-     * @param elementName the name of the element to which the new attribute
-     * will be added.
-     * @param attrName the attribute name.
-     * @param dataType the data type of the new attribute.
-     * @param required the flag which indicates whether this attribute
-     * must be present.
-     * @param defaultValue the default value of the attribute.
+     * @param elementName
+     *            the name of the element to which the new attribute will be
+     *            added.
+     * @param attrName
+     *            the attribute name.
+     * @param dataType
+     *            the data type of the new attribute.
+     * @param required
+     *            the flag which indicates whether this attribute must be
+     *            present.
+     * @param defaultValue
+     *            the default value of the attribute.
      */
-    protected void addAttribute(
-            String elementName, String attrName, int dataType,
-            boolean required, String defaultValue
-    ) {
+    protected void addAttribute(String elementName, String attrName, int dataType,
+            boolean required, String defaultValue) {
         if (attrName == null) {
             throw new IllegalArgumentException("attrName == null!");
         }
@@ -177,20 +204,23 @@
     /**
      * Adds a new attribute to an existing element.
      * 
-     * @param elementName the name of the element to which the new attribute
-     * will be added.
-     * @param attrName the attribute name.
-     * @param dataType the data type of the new attribute.
-     * @param required the flag which indicates whether this attribute
-     * must be present.
-     * @param defaultValue the default value of the attribute.
-     * @param enumeratedValues the legal values for the attribute as 
-     * a list of strings.
+     * @param elementName
+     *            the name of the element to which the new attribute will be
+     *            added.
+     * @param attrName
+     *            the attribute name.
+     * @param dataType
+     *            the data type of the new attribute.
+     * @param required
+     *            the flag which indicates whether this attribute must be
+     *            present.
+     * @param defaultValue
+     *            the default value of the attribute.
+     * @param enumeratedValues
+     *            the legal values for the attribute as a list of strings.
      */
-    protected void addAttribute(
-            String elementName, String attrName, int dataType,
-            boolean required, String defaultValue, List<String> enumeratedValues
-    ) {
+    protected void addAttribute(String elementName, String attrName, int dataType,
+            boolean required, String defaultValue, List<String> enumeratedValues) {
         if (attrName == null) {
             throw new IllegalArgumentException("attrName == null!");
         }
@@ -226,26 +256,30 @@
     /**
      * Adds a new attribute to an existing element.
      * 
-     * @param elementName the name of the element to which the new attribute
-     * will be added.
-     * @param attrName the attribute name.
-     * @param dataType the data type of the new attribute.
-     * @param required the flag which indicates whether this attribute
-     * must be present.
-     * @param defaultValue the default value of attribute.
-     * @param minValue the minimum legal value of an attribute.
-     * @param maxValue the maximum legal value of an attribute.
-     * @param minInclusive the flag which indicates  
-     * whether the minValue is inclusive.
-     * @param maxInclusive the flag which indicates  
-     * whether the maxValue is inclusive.
+     * @param elementName
+     *            the name of the element to which the new attribute will be
+     *            added.
+     * @param attrName
+     *            the attribute name.
+     * @param dataType
+     *            the data type of the new attribute.
+     * @param required
+     *            the flag which indicates whether this attribute must be
+     *            present.
+     * @param defaultValue
+     *            the default value of attribute.
+     * @param minValue
+     *            the minimum legal value of an attribute.
+     * @param maxValue
+     *            the maximum legal value of an attribute.
+     * @param minInclusive
+     *            the flag which indicates whether the minValue is inclusive.
+     * @param maxInclusive
+     *            the flag which indicates whether the maxValue is inclusive.
      */
-    protected void addAttribute(
-            String elementName, String attrName, int dataType,
-            boolean required, String defaultValue,
-            String minValue, String maxValue,
-            boolean minInclusive, boolean maxInclusive
-    ) {
+    protected void addAttribute(String elementName, String attrName, int dataType,
+            boolean required, String defaultValue, String minValue, String maxValue,
+            boolean minInclusive, boolean maxInclusive) {
         if (attrName == null) {
             throw new IllegalArgumentException("attrName == null!");
         }
@@ -272,20 +306,21 @@
     }
 
     /**
-     * Adds a new attribute with boolean data type to an existing 
-     * element.
+     * Adds a new attribute with boolean data type to an existing element.
      * 
-     * @param elementName the name of the element to which the new attribute
-     * will be added.
-     * @param attrName the attribute name.
-     * @param hasDefaultValue the flag which indicates whether this attribute
-     * must have a default value.
-     * @param defaultValue the default value.
+     * @param elementName
+     *            the name of the element to which the new attribute will be
+     *            added.
+     * @param attrName
+     *            the attribute name.
+     * @param hasDefaultValue
+     *            the flag which indicates whether this attribute must have a
+     *            default value.
+     * @param defaultValue
+     *            the default value.
      */
-    protected void addBooleanAttribute(
-            String elementName, String attrName,
-            boolean hasDefaultValue, boolean defaultValue
-    ) {
+    protected void addBooleanAttribute(String elementName, String attrName,
+            boolean hasDefaultValue, boolean defaultValue) {
         String defaultVal = hasDefaultValue ? (defaultValue ? "TRUE" : "FALSE") : null;
         ArrayList<String> values = new ArrayList<String>(2);
         values.add("TRUE");
@@ -295,11 +330,13 @@
     }
 
     /**
-     * Adds an existing element to the list of child elements 
-     * of the specified parent element.
+     * Adds an existing element to the list of child elements of the specified
+     * parent element.
      * 
-     * @param elementName the name of the element to be added.
-     * @param parentName the parent element name.
+     * @param elementName
+     *            the name of the element to be added.
+     * @param parentName
+     *            the parent element name.
      */
     protected void addChildElement(String elementName, String parentName) {
         Element parent = findElement(parentName);
@@ -308,23 +345,23 @@
     }
 
     /**
-     * Adds a new element type to this IIOMetadataFormat with 
-     * a child policy (if policy is not CHILD_POLICY_REPEAT).
+     * Adds a new element type to this IIOMetadataFormat with a child policy (if
+     * policy is not CHILD_POLICY_REPEAT).
      * 
-     * @param elementName the name of the element to be added.
-     * @param parentName the parent element name.
-     * @param childPolicy one of the CHILD_POLICY_* constants defined
-     * by IIOMetadataFormat.
+     * @param elementName
+     *            the name of the element to be added.
+     * @param parentName
+     *            the parent element name.
+     * @param childPolicy
+     *            one of the CHILD_POLICY_* constants defined by
+     *            IIOMetadataFormat.
      */
     protected void addElement(String elementName, String parentName, int childPolicy) {
-        if (
-                childPolicy < CHILD_POLICY_EMPTY ||
-                childPolicy > CHILD_POLICY_MAX ||
-                childPolicy == CHILD_POLICY_REPEAT
-        ) {
+        if (childPolicy < CHILD_POLICY_EMPTY || childPolicy > CHILD_POLICY_MAX
+                || childPolicy == CHILD_POLICY_REPEAT) {
             throw new IllegalArgumentException("childPolicy is not one of the predefined constants");
         }
-        
+
         Element parent = findElement(parentName);
         Element element = new Element();
         element.name = elementName;
@@ -334,19 +371,21 @@
     }
 
     /**
-     * Adds a new element type to this IIOMetadataFormat with 
-     * CHILD_POLICY_REPEAT and the specified minimum and maximum
-     * number of child elements.
+     * Adds a new element type to this IIOMetadataFormat with
+     * CHILD_POLICY_REPEAT and the specified minimum and maximum number of child
+     * elements.
      * 
-     * @param elementName the element name to be added.
-     * @param parentName the parent element name.
-     * @param minChildren the minimum number of child elements.
-     * @param maxChildren the maximum number of child elements.
+     * @param elementName
+     *            the element name to be added.
+     * @param parentName
+     *            the parent element name.
+     * @param minChildren
+     *            the minimum number of child elements.
+     * @param maxChildren
+     *            the maximum number of child elements.
      */
-    protected void addElement(
-            String elementName, String parentName,
-            int minChildren, int maxChildren
-    ) {
+    protected void addElement(String elementName, String parentName, int minChildren,
+            int maxChildren) {
         if (minChildren < 0) {
             throw new IllegalArgumentException("minChildren < 0!");
         }
@@ -365,19 +404,20 @@
     }
 
     /**
-     * Adds an Object reference with the specified class type to be 
-     * stored as element's value. 
+     * Adds an Object reference with the specified class type to be stored as
+     * element's value.
      * 
-     * @param elementName the element name.
-     * @param classType the class indicates the legal types for 
-     * the object's value.
-     * @param arrayMinLength the minimum legal length for the array.
-     * @param arrayMaxLength the maximum legal length for the array.
+     * @param elementName
+     *            the element name.
+     * @param classType
+     *            the class indicates the legal types for the object's value.
+     * @param arrayMinLength
+     *            the minimum legal length for the array.
+     * @param arrayMaxLength
+     *            the maximum legal length for the array.
      */
-    protected void addObjectValue(
-            String elementName, Class<?> classType,
-            int arrayMinLength, int arrayMaxLength
-    ) {
+    protected void addObjectValue(String elementName, Class<?> classType, int arrayMinLength,
+            int arrayMaxLength) {
         Element element = findElement(elementName);
 
         ObjectValue objVal = new ObjectValue();
@@ -390,20 +430,20 @@
     }
 
     /**
-     * Adds an Object reference with the specified class type to be 
-     * stored as an element's value. 
+     * Adds an Object reference with the specified class type to be stored as an
+     * element's value.
      * 
-     * @param elementName the element name.
-     * @param classType the class indicates the legal types for 
-     * the object's value.
-     * @param required a flag indicated that this object value 
-     * must be present.
-     * @param defaultValue the default value, or null.
+     * @param elementName
+     *            the element name.
+     * @param classType
+     *            the class indicates the legal types for the object's value.
+     * @param required
+     *            a flag indicated that this object value must be present.
+     * @param defaultValue
+     *            the default value, or null.
      */
-    protected <T> void addObjectValue(
-            String elementName, Class<T> classType,
-            boolean required, T defaultValue
-    ) {
+    protected <T> void addObjectValue(String elementName, Class<T> classType, boolean required,
+            T defaultValue) {
         // note: reqired is an unused parameter
         Element element = findElement(elementName);
 
@@ -416,22 +456,22 @@
     }
 
     /**
-     * Adds an Object reference with the specified class type to be 
-     * stored as the element's value. 
+     * Adds an Object reference with the specified class type to be stored as
+     * the element's value.
      * 
-     * @param elementName the element name.
-     * @param classType the class indicates the legal types for 
-     * the object value.
-     * @param required a flag indicated that this object value 
-     * must be present.
-     * @param defaultValue the default value, or null.
-     * @param enumeratedValues the list of legal values for the object.
+     * @param elementName
+     *            the element name.
+     * @param classType
+     *            the class indicates the legal types for the object value.
+     * @param required
+     *            a flag indicated that this object value must be present.
+     * @param defaultValue
+     *            the default value, or null.
+     * @param enumeratedValues
+     *            the list of legal values for the object.
      */
-    protected <T> void addObjectValue(
-            String elementName, Class<T> classType,
-            boolean required, T defaultValue,
-            List<? extends T> enumeratedValues
-    ) {
+    protected <T> void addObjectValue(String elementName, Class<T> classType, boolean required,
+            T defaultValue, List<? extends T> enumeratedValues) {
         // note: reqired is an unused parameter
         if (enumeratedValues == null || enumeratedValues.isEmpty()) {
             throw new IllegalArgumentException("enumeratedValues is empty or null");
@@ -444,7 +484,8 @@
                 }
             }
         } catch (ClassCastException e) {
-            throw new IllegalArgumentException("enumeratedValues contains a value not of class classType!");
+            throw new IllegalArgumentException(
+                    "enumeratedValues contains a value not of class classType!");
         }
 
         Element element = findElement(elementName);
@@ -459,25 +500,27 @@
     }
 
     /**
-     * Adds an Object reference with the specified class type to be 
-     * stored as the element's value. 
+     * Adds an Object reference with the specified class type to be stored as
+     * the element's value.
      * 
-     * @param elementName the element name.
-     * @param classType the class indicates the legal types for 
-     * the object value.
-     * @param defaultValue the default value, or null.
-     * @param minValue the minimum legal value for the object value. 
-     * @param maxValue the maximum legal value for the object value. 
-     * @param minInclusive the flag which indicates 
-     * whether the minValue is inclusive.
-     * @param maxInclusive the flag which indicates 
-     * whether the maxValue is inclusive.
+     * @param elementName
+     *            the element name.
+     * @param classType
+     *            the class indicates the legal types for the object value.
+     * @param defaultValue
+     *            the default value, or null.
+     * @param minValue
+     *            the minimum legal value for the object value.
+     * @param maxValue
+     *            the maximum legal value for the object value.
+     * @param minInclusive
+     *            the flag which indicates whether the minValue is inclusive.
+     * @param maxInclusive
+     *            the flag which indicates whether the maxValue is inclusive.
      */
-    protected <T extends Object & Comparable<? super T>> void addObjectValue(
-            String elementName, Class<T> classType,
-            T defaultValue, Comparable<? super T> minValue, Comparable<? super T> maxValue,
-            boolean minInclusive, boolean maxInclusive
-    ) {
+    protected <T extends Object & Comparable<? super T>> void addObjectValue(String elementName,
+            Class<T> classType, T defaultValue, Comparable<? super T> minValue,
+            Comparable<? super T> maxValue, boolean minInclusive, boolean maxInclusive) {
         Element element = findElement(elementName);
 
         ObjectValue<T> objVal = new ObjectValue<T>();
@@ -540,7 +583,7 @@
         if ((attr.valueType & VALUE_RANGE) == 0) {
             throw new IllegalArgumentException("Attribute is not a range!");
         }
-        return attr.maxValue;        
+        return attr.maxValue;
     }
 
     public String getAttributeMinValue(String elementName, String attrName) {
@@ -558,12 +601,13 @@
 
     public int getAttributeValueType(String elementName, String attrName) {
         Attlist attr = findAttribute(elementName, attrName);
-        return attr.valueType;                
+        return attr.valueType;
     }
 
     public String[] getChildNames(String elementName) {
         Element element = findElement(elementName);
-        if (element.childPolicy == CHILD_POLICY_EMPTY) { // Element cannot have children
+        if (element.childPolicy == CHILD_POLICY_EMPTY) { // Element cannot have
+            // children
             return null;
         }
         return element.children.toArray(new String[element.children.size()]);
@@ -689,10 +733,12 @@
     }
 
     /**
-     * Removes the specified attribute from the specified element. 
-     *  
-     * @param elementName the specified element name.
-     * @param attrName the specified attribute name.
+     * Removes the specified attribute from the specified element.
+     * 
+     * @param elementName
+     *            the specified element name.
+     * @param attrName
+     *            the specified attribute name.
      */
     protected void removeAttribute(String elementName, String attrName) {
         Element element = findElement(elementName);
@@ -702,7 +748,8 @@
     /**
      * Removes the specified element from this format.
      * 
-     * @param elementName the specified element name.
+     * @param elementName
+     *            the specified element name.
      */
     protected void removeElement(String elementName) {
         Element element;
@@ -717,18 +764,20 @@
     /**
      * Removes the object value from the specified element.
      * 
-     * @param elementName the element name.
+     * @param elementName
+     *            the element name.
      */
     protected void removeObjectValue(String elementName) {
         Element element = findElement(elementName);
         element.objectValue = null;
     }
-    
+
     /**
-     * Sets a new base name for ResourceBundles containing 
-     * descriptions of elements and attributes for this format.
+     * Sets a new base name for ResourceBundles containing descriptions of
+     * elements and attributes for this format.
      * 
-     * @param resourceBaseName the new resource base name.
+     * @param resourceBaseName
+     *            the new resource base name.
      */
     protected void setResourceBaseName(String resourceBaseName) {
         if (resourceBaseName == null) {
@@ -740,117 +789,181 @@
     /**
      * The Class Element.
      */
-    @SuppressWarnings({"ClassWithoutConstructor"})
+    @SuppressWarnings( {
+        "ClassWithoutConstructor"
+    })
     private class Element {
-        
-        /** The name. */
+
+        /**
+         * The name.
+         */
         String name;
 
-        /** The children. */
+        /**
+         * The children.
+         */
         ArrayList<String> children = new ArrayList<String>();
-        
-        /** The attributes. */
+
+        /**
+         * The attributes.
+         */
         HashMap<String, Attlist> attributes = new HashMap<String, Attlist>();
 
-        /** The min children. */
+        /**
+         * The min children.
+         */
         int minChildren;
-        
-        /** The max children. */
+
+        /**
+         * The max children.
+         */
         int maxChildren;
-        
-        /** The child policy. */
+
+        /**
+         * The child policy.
+         */
         int childPolicy;
 
-        /** The object value. */
+        /**
+         * The object value.
+         */
         ObjectValue objectValue;
     }
 
     /**
      * The Class Attlist.
      */
-    @SuppressWarnings({"ClassWithoutConstructor"})
+    @SuppressWarnings( {
+        "ClassWithoutConstructor"
+    })
     private class Attlist {
-        
-        /** The name. */
+
+        /**
+         * The name.
+         */
         String name;
 
-        /** The data type. */
+        /**
+         * The data type.
+         */
         int dataType;
-        
-        /** The required. */
+
+        /**
+         * The required.
+         */
         boolean required;
-        
-        /** The list min length. */
+
+        /**
+         * The list min length.
+         */
         int listMinLength;
-        
-        /** The list max length. */
+
+        /**
+         * The list max length.
+         */
         int listMaxLength;
-        
-        /** The default value. */
+
+        /**
+         * The default value.
+         */
         String defaultValue;
-        
-        /** The enumerated values. */
+
+        /**
+         * The enumerated values.
+         */
         List<String> enumeratedValues;
-        
-        /** The min value. */
+
+        /**
+         * The min value.
+         */
         String minValue;
-        
-        /** The max value. */
+
+        /**
+         * The max value.
+         */
         String maxValue;
-        
-        /** The min inclusive. */
+
+        /**
+         * The min inclusive.
+         */
         boolean minInclusive;
-        
-        /** The max inclusive. */
+
+        /**
+         * The max inclusive.
+         */
         boolean maxInclusive;
 
-        /** The value type. */
+        /**
+         * The value type.
+         */
         int valueType;
     }
 
     /**
      * The Class ObjectValue.
      */
-    @SuppressWarnings({"ClassWithoutConstructor"})
+    @SuppressWarnings( {
+        "ClassWithoutConstructor"
+    })
     private class ObjectValue<T> {
-        
-        /** The class type. */
+
+        /**
+         * The class type.
+         */
         Class<T> classType;
-        
-        /** The array min length. */
+
+        /**
+         * The array min length.
+         */
         int arrayMinLength;
-        
-        /** The array max length. */
+
+        /**
+         * The array max length.
+         */
         int arrayMaxLength;
-        
-        /** The default value. */
+
+        /**
+         * The default value.
+         */
         T defaultValue;
-        
-        /** The enumerated values. */
+
+        /**
+         * The enumerated values.
+         */
         List<? extends T> enumeratedValues;
-        
-        /** The min value. */
+
+        /**
+         * The min value.
+         */
         Comparable<? super T> minValue;
-        
-        /** The max value. */
+
+        /**
+         * The max value.
+         */
         Comparable<? super T> maxValue;
-        
-        /** The min inclusive. */
+
+        /**
+         * The min inclusive.
+         */
         boolean minInclusive;
-        
-        /** The max inclusive. */
+
+        /**
+         * The max inclusive.
+         */
         boolean maxInclusive;
 
-        /** The value type. */
+        /**
+         * The value type.
+         */
         int valueType;
     }
 
     /**
      * Find element.
      * 
-     * @param name the name
-     * 
-     * @return the element
+     * @param name
+     *            the name.
+     * @return the element.
      */
     private Element findElement(String name) {
         Element element;
@@ -864,16 +977,18 @@
     /**
      * Find attribute.
      * 
-     * @param elementName the element name
-     * @param attributeName the attribute name
-     * 
-     * @return the attlist
+     * @param elementName
+     *            the element name.
+     * @param attributeName
+     *            the attribute name.
+     * @return the attlist.
      */
     private Attlist findAttribute(String elementName, String attributeName) {
         Element element = findElement(elementName);
         Attlist attribute;
         if ((attribute = element.attributes.get(attributeName)) == null) {
-            throw new IllegalArgumentException("attribute name is null or no such attribute: " + attributeName);
+            throw new IllegalArgumentException("attribute name is null or no such attribute: "
+                    + attributeName);
         }
 
         return attribute;
@@ -882,9 +997,9 @@
     /**
      * Find object value.
      * 
-     * @param elementName the element name
-     * 
-     * @return the object value
+     * @param elementName
+     *            the element name.
+     * @return the object value.
      */
     private ObjectValue findObjectValue(String elementName) {
         Element element = findElement(elementName);
@@ -898,23 +1013,25 @@
     /**
      * Gets the resource string.
      * 
-     * @param key the key
-     * @param locale the locale
-     * 
-     * @return the resource string
+     * @param key
+     *            the key.
+     * @param locale
+     *            the locale.
+     * @return the resource string.
      */
     private String getResourceString(String key, Locale locale) {
         if (locale == null) {
             locale = Locale.getDefault();
         }
 
-        // Get the context class loader and try to locate the bundle with it first
-        ClassLoader contextClassloader = AccessController.doPrivileged(
-                new PrivilegedAction<ClassLoader>() {
+        // Get the context class loader and try to locate the bundle with it
+        // first
+        ClassLoader contextClassloader = AccessController
+                .doPrivileged(new PrivilegedAction<ClassLoader>() {
                     public ClassLoader run() {
                         return Thread.currentThread().getContextClassLoader();
                     }
-        });
+                });
 
         // Now try to get the resource bundle
         ResourceBundle rb;
diff --git a/awt/javax/imageio/metadata/IIOMetadataNode.java b/awt/javax/imageio/metadata/IIOMetadataNode.java
index d5ab7a5..adc6d67 100644
--- a/awt/javax/imageio/metadata/IIOMetadataNode.java
+++ b/awt/javax/imageio/metadata/IIOMetadataNode.java
@@ -27,47 +27,71 @@
 import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
+
 //???AWT
 //import org.w3c.dom.TypeInfo;
 //import org.w3c.dom.UserDataHandler;
 
 /**
- * The Class IIOMetadataNode represents a node of the 
- * (DOM-style) metadata tree.
+ * The Class IIOMetadataNode represents a node of the (DOM-style) metadata tree.
+ * 
+ * @since Android 1.0
  */
 public class IIOMetadataNode implements Element, NodeList {
 
-    /** The node name. */
+    /**
+     * The node name.
+     */
     private String nodeName;
-    
-    /** The node value. */
+
+    /**
+     * The node value.
+     */
     private String nodeValue;
-    
-    /** The attributes. */
+
+    /**
+     * The attributes.
+     */
     private IIOMetadataNodeList attrs = new IIOMetadataNodeList(new ArrayList<IIOMetadataNode>());
 
-    /** The parent node. */
+    /**
+     * The parent node.
+     */
     private IIOMetadataNode parent;
-    
-    /** The first child node. */
+
+    /**
+     * The first child node.
+     */
     private IIOMetadataNode firstChild;
-    
-    /** The last child node. */
+
+    /**
+     * The last child node.
+     */
     private IIOMetadataNode lastChild;
-    
-    /** The previous sibling. */
+
+    /**
+     * The previous sibling.
+     */
     private IIOMetadataNode previousSibling;
-    
-    /** The next sibling. */
+
+    /**
+     * The next sibling.
+     */
     private IIOMetadataNode nextSibling;
 
-    /** The number of children. */
+    /**
+     * The number of children.
+     */
     private int nChildren;
 
-    /** The user object associated with this node. */
+    /**
+     * The user object associated with this node.
+     */
     private Object userObject;
 
-    /** The text content of this node. */
+    /**
+     * The text content of this node.
+     */
     private String textContent;
 
     /**
@@ -79,18 +103,20 @@
     /**
      * Instantiates a new empty node with the specified name.
      * 
-     * @param nodeName the node name
+     * @param nodeName
+     *            the node name.
      */
     public IIOMetadataNode(String nodeName) {
         this.nodeName = nodeName;
     }
 
     /**
-     * Instantiates a new IIOMetadataNode with the specified 
-     * name and value.
+     * Instantiates a new IIOMetadataNode with the specified name and value.
      * 
-     * @param nodeName the node name
-     * @param nodeValue the node value
+     * @param nodeName
+     *            the node name.
+     * @param nodeValue
+     *            the node value.
      */
     private IIOMetadataNode(String nodeName, String nodeValue) {
         this.nodeName = nodeName;
@@ -102,12 +128,12 @@
     }
 
     public String getAttribute(String name) {
-        Attr attrNode = (Attr) attrs.getNamedItem(name);
+        Attr attrNode = (Attr)attrs.getNamedItem(name);
         return (attrNode == null) ? "" : attrNode.getValue();
     }
 
     public void setAttribute(String name, String value) throws DOMException {
-        Attr attr = (Attr) attrs.getNamedItem(name);
+        Attr attr = (Attr)attrs.getNamedItem(name);
         if (attr != null) {
             attr.setValue(value);
         } else {
@@ -116,7 +142,7 @@
     }
 
     public void removeAttribute(String name) throws DOMException {
-        IIOMetadataAttr attr = (IIOMetadataAttr) attrs.getNamedItem(name);
+        IIOMetadataAttr attr = (IIOMetadataAttr)attrs.getNamedItem(name);
         if (attr != null) {
             attr.setOwnerElement(null);
             attrs.list.remove(attr);
@@ -124,17 +150,19 @@
     }
 
     public Attr getAttributeNode(String name) {
-        return (Attr) attrs.getNamedItem(name);
+        return (Attr)attrs.getNamedItem(name);
     }
 
     public Attr setAttributeNode(Attr newAttr) throws DOMException {
         // Check if this attribute is already in use.
         Element owner = newAttr.getOwnerElement();
         if (owner != null) {
-            if (owner == this) { // Replacing an attribute node by itself has no effect
+            if (owner == this) { // Replacing an attribute node by itself has no
+                // effect
                 return null;
             } else {
-                throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR, "Attribute is already in use");
+                throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR,
+                        "Attribute is already in use");
             }
         }
 
@@ -146,7 +174,7 @@
 
         IIOMetadataAttr iioAttr;
         if (newAttr instanceof IIOMetadataAttr) {
-            iioAttr = (IIOMetadataAttr) newAttr;
+            iioAttr = (IIOMetadataAttr)newAttr;
             iioAttr.setOwnerElement(this);
         } else {
             iioAttr = new IIOMetadataAttr(name, newAttr.getValue(), this);
@@ -206,7 +234,8 @@
         return getAttribute(localName);
     }
 
-    public void setAttributeNS(String namespaceURI, String qualifiedName, String value) throws DOMException {
+    public void setAttributeNS(String namespaceURI, String qualifiedName, String value)
+            throws DOMException {
         setAttribute(qualifiedName, value);
     }
 
@@ -222,7 +251,8 @@
         return setAttributeNode(newAttr);
     }
 
-    public NodeList getElementsByTagNameNS(String namespaceURI, String localName) throws DOMException {
+    public NodeList getElementsByTagNameNS(String namespaceURI, String localName)
+            throws DOMException {
         return getElementsByTagName(localName);
     }
 
@@ -234,20 +264,105 @@
         return hasAttribute(localName);
     }
 
-    //???AWT
+    // ???AWT
     /*
-    public TypeInfo getSchemaTypeInfo() {
-        throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported");
-    }*/
+     * public TypeInfo getSchemaTypeInfo() { throw new
+     * DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported"); }
+     */
 
+    /**
+     * <i>Description copied from interface: org.w3c.dom.Element (DOM Level
+     * 3)</i>
+     * <p>
+     * If the parameter isId is true, this method declares the specified
+     * attribute to be a user-determined ID attribute . This affects the value
+     * of Attr.isId and the behavior of Document.getElementById, but does not
+     * change any schema that may be in use, in particular this does not affect
+     * the Attr.schemaTypeInfo of the specified Attr node. Use the value false
+     * for the parameter isId to undeclare an attribute for being a
+     * user-determined ID attribute. To specify an attribute by local name and
+     * namespace URI, use the setIdAttributeNS method.
+     * </p>
+     * 
+     * @param name
+     *            the name of the attribute.
+     * @param isId
+     *            the flag which determines whether this attribute is of type
+     *            ID.
+     * @throws DOMException
+     *             if a DOM error occurred while setting the attribute type.
+     *             <p>
+     *             NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
+     *             <br>
+     *             NOT_FOUND_ERR: Raised if the specified node is not an
+     *             attribute of this element.
+     *             </p>
+     */
     public void setIdAttribute(String name, boolean isId) throws DOMException {
         throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported");
     }
 
-    public void setIdAttributeNS(String namespaceURI, String localName, boolean isId) throws DOMException {
+    /**
+     * <i>Description copied from interface: org.w3c.dom.Element (DOM Level
+     * 3)</i>
+     * <p>
+     * If the parameter isId is true, this method declares the specified
+     * attribute to be a user-determined ID attribute . This affects the value
+     * of Attr.isId and the behavior of Document.getElementById, but does not
+     * change any schema that may be in use, in particular this does not affect
+     * the Attr.schemaTypeInfo of the specified Attr node. Use the value false
+     * for the parameter isId to undeclare an attribute for being a
+     * user-determined ID attribute.
+     * </p>
+     * 
+     * @param namespaceURI
+     *            the namespace URI of the attribute.
+     * @param localName
+     *            the local name of the attribute.
+     * @param isId
+     *            the flag which determines whether this attribute is of type
+     *            ID.
+     * @throws DOMException
+     *             if a DOM error occurred while setting the attribute type.
+     *             <p>
+     *             NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
+     *             <br>
+     *             NOT_FOUND_ERR: Raised if the specified node is not an
+     *             attribute of this element.
+     *             </p>
+     */
+    public void setIdAttributeNS(String namespaceURI, String localName, boolean isId)
+            throws DOMException {
         throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported");
     }
 
+    /**
+     * <i>Description copied from interface: org.w3c.dom.Element (DOM Level
+     * 3)</i>
+     * <p>
+     * If the parameter isId is true, this method declares the specified
+     * attribute to be a user-determined ID attribute . This affects the value
+     * of Attr.isId and the behavior of Document.getElementById, but does not
+     * change any schema that may be in use, in particular this does not affect
+     * the Attr.schemaTypeInfo of the specified Attr node. Use the value false
+     * for the parameter isId to undeclare an attribute for being a
+     * user-determined ID attribute.
+     * </p>
+     * 
+     * @param idAttr
+     *            the attribute node.
+     * @param isId
+     *            the flag which determines whether this attribute is of type
+     *            ID.
+     * @throws DOMException
+     *             if a DOM error occurred while setting the attribute type.
+     *             <p>
+     *             NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
+     *             <br>
+     *             NOT_FOUND_ERR: Raised if the specified node is not an
+     *             attribute of this element.
+     *             </p>
+     */
     public void setIdAttributeNode(Attr idAttr, boolean isId) throws DOMException {
         throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported");
     }
@@ -305,8 +420,8 @@
             throw new IllegalArgumentException("newChild == null!");
         }
 
-        IIOMetadataNode newIIOChild = (IIOMetadataNode) newChild;
-        IIOMetadataNode refIIOChild = (IIOMetadataNode) refChild;
+        IIOMetadataNode newIIOChild = (IIOMetadataNode)newChild;
+        IIOMetadataNode refIIOChild = (IIOMetadataNode)refChild;
 
         newIIOChild.parent = this;
 
@@ -349,8 +464,8 @@
             throw new IllegalArgumentException("newChild == null!");
         }
 
-        IIOMetadataNode newIIOChild = (IIOMetadataNode) newChild;
-        IIOMetadataNode oldIIOChild = (IIOMetadataNode) oldChild;
+        IIOMetadataNode newIIOChild = (IIOMetadataNode)newChild;
+        IIOMetadataNode oldIIOChild = (IIOMetadataNode)oldChild;
 
         IIOMetadataNode next = oldIIOChild.nextSibling;
         IIOMetadataNode previous = oldIIOChild.previousSibling;
@@ -389,7 +504,7 @@
             throw new IllegalArgumentException("oldChild == null!");
         }
 
-        IIOMetadataNode oldIIOChild = (IIOMetadataNode) oldChild;
+        IIOMetadataNode oldIIOChild = (IIOMetadataNode)oldChild;
 
         // Fix next and previous
         IIOMetadataNode previous = oldIIOChild.previousSibling;
@@ -439,7 +554,8 @@
             }
         }
 
-        return cloned;  //To change body of implemented methods use File | Settings | File Templates.
+        return cloned; // To change body of implemented methods use File |
+        // Settings | File Templates.
     }
 
     public void normalize() {
@@ -470,52 +586,314 @@
         return attrs.list.size() > 0;
     }
 
+    /**
+     * <i>Description copied from interface: org.w3c.dom.Node (DOM Level 3)</i>
+     * <p>
+     * The absolute base URI of this node or null if the implementation wasn't
+     * able to obtain an absolute URI. This value is computed as described in.
+     * However, when the Document supports the feature "HTML" [DOM Level 2
+     * HTML], the base URI is computed using first the value of the href
+     * attribute of the HTML BASE element if any, and the value of the
+     * documentURI attribute from the Document interface otherwise.
+     * </p>
+     * 
+     * @return the string representation of the absolute base URI.
+     */
     public String getBaseURI() {
         throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported");
     }
 
+    /**
+     * <i>Description copied from interface: org.w3c.dom.Node (DOM Level 3)</i>
+     * <p>
+     * Compares the reference node, i.e. the node on which this method is being
+     * called, with a node, i.e. the one passed as a parameter, with regard to
+     * their position in the document and according to the document order.
+     * </p>
+     * 
+     * @param other
+     *            the node to compare against the reference node.
+     * @return Returns how the node is positioned relatively to the reference
+     *         node.
+     * @throws DOMException
+     *             NOT_SUPPORTED_ERR: when the compared nodes are from different
+     *             DOM implementations that do not coordinate to return
+     *             consistent implementation-specific results.
+     */
     public short compareDocumentPosition(Node other) throws DOMException {
         throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported");
     }
 
+    /**
+     * <i>Description copied from interface: org.w3c.dom.Node (DOM Level 3)</i>
+     * <p>
+     * This attribute returns the text content of this node and its descendants.
+     * When it is defined to be null, setting it has no effect. On setting, any
+     * possible children this node may have are removed and, if it the new
+     * string is not empty or null, replaced by a single Text node containing
+     * the string this attribute is set to. On getting, no serialization is
+     * performed, the returned string does not contain any markup. No whitespace
+     * normalization is performed and the returned string does not contain the
+     * white spaces in element content (see the attribute
+     * Text.isElementContentWhitespace). Similarly, on setting, no parsing is
+     * performed either, the input string is taken as pure textual content. The
+     * string returned is made of the text content of this node depending on its
+     * type, as defined below:
+     * <table>
+     * <tr>
+     * <td><strong>Node type</strong></td>
+     * <td><strong>Content</strong></td>
+     * </tr>
+     * <tr>
+     * <td>ELEMENT_NODE, ATTRIBUTE_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE,
+     * DOCUMENT_FRAGMENT_NODE</td>
+     * <td>concatenation of the textContent attribute value of every child node,
+     * excluding COMMENT_NODE and PROCESSING_INSTRUCTION_NODE nodes. This is the
+     * empty string if the node has no children.</td>
+     * </tr>
+     * <tr>
+     * <td>TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE,
+     * PROCESSING_INSTRUCTION_NODE</td>
+     * <td>nodeValue</td>
+     * </tr>
+     * <tr>
+     * <td>DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE</td>
+     * <td>null</td>
+     * </tr>
+     * </table>
+     * </p>
+     * 
+     * @return the text content depending on the type of this node.
+     * @throws DOMException
+     *             DOMSTRING_SIZE_ERR: Raised when it would return more
+     *             characters than fit in a DOMString variable on the
+     *             implementation platform.
+     */
     public String getTextContent() throws DOMException {
         return textContent;
     }
 
+    /**
+     * <i>Description copied from interface: org.w3c.dom.Node (DOM Level 3)</i>
+     * <p>
+     * This attribute returns the text content of this node and its descendants.
+     * When it is defined to be null, setting it has no effect. On setting, any
+     * possible children this node may have are removed and, if it the new
+     * string is not empty or null, replaced by a single Text node containing
+     * the string this attribute is set to. On getting, no serialization is
+     * performed, the returned string does not contain any markup. No whitespace
+     * normalization is performed and the returned string does not contain the
+     * white spaces in element content (see the attribute
+     * Text.isElementContentWhitespace). Similarly, on setting, no parsing is
+     * performed either, the input string is taken as pure textual content. The
+     * string returned is made of the text content of this node depending on its
+     * type, as defined below:
+     * <table>
+     * <tr>
+     * <td><strong>Node type</strong></td>
+     * <td><strong>Content</strong></td>
+     * </tr>
+     * <tr>
+     * <td>ELEMENT_NODE, ATTRIBUTE_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE,
+     * DOCUMENT_FRAGMENT_NODE</td>
+     * <td>concatenation of the textContent attribute value of every child node,
+     * excluding COMMENT_NODE and PROCESSING_INSTRUCTION_NODE nodes. This is the
+     * empty string if the node has no children.</td>
+     * </tr>
+     * <tr>
+     * <td>TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE,
+     * PROCESSING_INSTRUCTION_NODE</td>
+     * <td>nodeValue</td>
+     * </tr>
+     * <tr>
+     * <td>DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE</td>
+     * <td>null</td>
+     * </tr>
+     * </table>
+     * </p>
+     * 
+     * @param textContent
+     *            the text content for this node.
+     * @throws DOMException
+     *             NO_MODIFICATION_ALLOWED_ERR: Raised when the node is
+     *             readonly.
+     */
     public void setTextContent(String textContent) throws DOMException {
         this.textContent = textContent;
     }
 
+    /**
+     * <i>Description copied from interface: org.w3c.dom.Node (DOM Level 3)</i>
+     * <p>
+     * Returns whether this node is the same node as the given one. This method
+     * provides a way to determine whether two Node references returned by the
+     * implementation reference the same object. When two Node references are
+     * references to the same object, even if through a proxy, the references
+     * may be used completely interchangeably, such that all attributes have the
+     * same values and calling the same DOM method on either reference always
+     * has exactly the same effect.
+     * </p>
+     * 
+     * @param other
+     *            the node to test against.
+     * @return true, if the nodes are the same, false otherwise.
+     */
     public boolean isSameNode(Node other) {
         throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported");
     }
 
+    /**
+     * <i>Description copied from interface: org.w3c.dom.Node (DOM Level 3)</i>
+     * <p>
+     * Look up the prefix associated to the given namespace URI, starting from
+     * this node. The default namespace declarations are ignored by this method.
+     * See for details on the algorithm used by this method.
+     * </p>
+     * 
+     * @param namespaceURI
+     *            the namespace URI to look for.
+     * @return the associated namespace prefix if found or null if none is
+     *         found. If more than one prefix are associated to the namespace
+     *         prefix, the returned namespace prefix is implementation
+     *         dependent.
+     */
     public String lookupPrefix(String namespaceURI) {
         throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported");
     }
 
+    /**
+     * <i>Description copied from interface: org.w3c.dom.Node (DOM Level 3)</i>
+     * <p>
+     * This method checks if the specified namespaceURI is the default namespace
+     * or not.
+     * </p>
+     * 
+     * @param namespaceURI
+     *            the namespace URI to look for.
+     * @return true, if the specified namespaceURI is the default namespace,
+     *         false otherwise.
+     */
     public boolean isDefaultNamespace(String namespaceURI) {
         throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported");
     }
 
+    /**
+     * <i>Description copied from interface: org.w3c.dom.Node (DOM Level 3)</i>
+     * <p>
+     * Look up the namespace URI associated to the given prefix, starting from
+     * this node. See for details on the algorithm used by this method.
+     * </p>
+     * 
+     * @param prefix
+     *            the prefix to look for. If this parameter is null, the method
+     *            will return the default namespace URI if any.
+     * @return the associated namespace URI or null if none is found.
+     */
     public String lookupNamespaceURI(String prefix) {
         throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported");
     }
 
+    /**
+     * <i>Description copied from interface: org.w3c.dom.Node (DOM Level 3)</i>
+     * <p>
+     * Tests whether two nodes are equal. This method tests for equality of
+     * nodes, not sameness (i.e., whether the two nodes are references to the
+     * same object) which can be tested with Node.isSameNode(). All nodes that
+     * are the same will also be equal, though the reverse may not be true. Two
+     * nodes are equal if and only if the following conditions are satisfied:
+     * <p>
+     * <li>The two nodes are of the same type.</li>
+     * <li>The following string attributes are equal: nodeName, localName,
+     * namespaceURI, prefix, nodeValue . This is: they are both null, or they
+     * have the same length and are character for character identical.</li>
+     * <li>The attributes NamedNodeMaps are equal. This is: they are both null,
+     * or they have the same length and for each node that exists in one map
+     * there is a node that exists in the other map and is equal, although not
+     * necessarily at the same index.</li>
+     * <li>The childNodes NodeLists are equal. This is: they are both null, or
+     * they have the same length and contain equal nodes at the same index. Note
+     * that normalization can affect equality; to avoid this, nodes should be
+     * normalized before being compared.</li>
+     * </p>
+     * For two DocumentType nodes to be equal, the following conditions must
+     * also be satisfied:
+     * <p>
+     * <li>The following string attributes are equal: publicId, systemId,
+     * internalSubset.</li>
+     * <li>The entities NamedNodeMaps are equal.</li>
+     * <li>The notations NamedNodeMaps are equal.</li>
+     * </p>
+     * On the other hand, the following do not affect equality: the
+     * ownerDocument, baseURI, and parentNode attributes, the specified
+     * attribute for Attr nodes, the schemaTypeInfo attribute for Attr and
+     * Element nodes, the Text.isElementContentWhitespace attribute for Text
+     * nodes, as well as any user data or event listeners registered on the
+     * nodes. </p>
+     * <p>
+     * Note: As a general rule, anything not mentioned in the description above
+     * is not significant in consideration of equality checking. Note that
+     * future versions of this specification may take into account more
+     * attributes and implementations conform to this specification are expected
+     * to be updated accordingly.
+     * </p>
+     * 
+     * @param arg
+     *            the node to compare equality with.
+     * @return true, if the nodes are equal, false otherwise.
+     */
     public boolean isEqualNode(Node arg) {
         throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported");
     }
 
+    /**
+     * <i>Description copied from interface: org.w3c.dom.Node (DOM Level 3)</i>
+     * <p>
+     * This method returns a specialized object which implements the specialized
+     * APIs of the specified feature and version, as specified in. The
+     * specialized object may also be obtained by using binding-specific casting
+     * methods but is not necessarily expected to, as discussed in. This method
+     * also allow the implementation to provide specialized objects which do not
+     * support the Node interface.
+     * </p>
+     * 
+     * @param feature
+     *            the name of the feature requested. Note that any plus sign "+"
+     *            prepended to the name of the feature will be ignored since it
+     *            is not significant in the context of this method.
+     * @param version
+     *            this is the version number of the feature to test.
+     * @return the object which implements the specialized APIs of the specified
+     *         feature and version, if any, or null if there is no object which
+     *         implements interfaces associated with that feature. If the
+     *         DOMObject returned by this method implements the Node interface,
+     *         it must delegate to the primary core Node and not return results
+     *         inconsistent with the primary core Node such as attributes,
+     *         childNodes, etc.
+     */
     public Object getFeature(String feature, String version) {
         throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported");
     }
 
-    //???AWT
+    // ???AWT
     /*
-    public Object setUserData(String key, Object data, UserDataHandler handler) {
-        throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported");
-    }*/
+     * public Object setUserData(String key, Object data, UserDataHandler
+     * handler) { throw new DOMException(DOMException.NOT_SUPPORTED_ERR,
+     * "Method not supported"); }
+     */
 
+    /**
+     * <i>Description copied from interface: org.w3c.dom.Node (DOM Level 3)</i>
+     * <p>
+     * Retrieves the object associated to a key on a this node. The object must
+     * first have been set to this node by calling setUserData with the same
+     * key.
+     * </p>
+     * 
+     * @param key
+     *            the key the object is associated to.
+     * @return the DOMUserData associated to the given key on this node, or null
+     *         if there was none.
+     */
     public Object getUserData(String key) {
         throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported");
     }
@@ -540,7 +918,7 @@
     /**
      * Gets the user object associated with this node.
      * 
-     * @return the user object associated with this node
+     * @return the user object associated with this node.
      */
     public Object getUserObject() {
         return userObject;
@@ -549,7 +927,8 @@
     /**
      * Sets the user object associated with this node.
      * 
-     * @param userObject the new user object associated with this node
+     * @param userObject
+     *            the new user object associated with this node.
      */
     public void setUserObject(Object userObject) {
         this.userObject = userObject;
@@ -559,16 +938,21 @@
      * The Class IIOMetadataAttr.
      */
     private class IIOMetadataAttr extends IIOMetadataNode implements Attr {
-        
-        /** The owner element. */
+
+        /**
+         * The owner element.
+         */
         private Element ownerElement;
 
         /**
          * Instantiates a new iIO metadata attr.
          * 
-         * @param name the name
-         * @param value the value
-         * @param owner the owner
+         * @param name
+         *            the name.
+         * @param value
+         *            the value.
+         * @param owner
+         *            the owner.
          */
         public IIOMetadataAttr(String name, String value, Element owner) {
             super(name, value);
@@ -598,12 +982,16 @@
         /**
          * Sets the owner element.
          * 
-         * @param ownerElement the new owner element
+         * @param ownerElement
+         *            the new owner element.
          */
         public void setOwnerElement(Element ownerElement) {
             this.ownerElement = ownerElement;
         }
 
+        /**
+         * @return
+         */
         public boolean isId() {
             throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported");
         }
@@ -618,14 +1006,17 @@
      * The Class IIOMetadataNodeList.
      */
     private class IIOMetadataNodeList implements NodeList, NamedNodeMap {
-        
-        /** The list. */
+
+        /**
+         * The list.
+         */
         private List<IIOMetadataNode> list;
 
         /**
          * Instantiates a new iIO metadata node list.
          * 
-         * @param list the list
+         * @param list
+         *            the list.
          */
         IIOMetadataNodeList(List<IIOMetadataNode> list) {
             this.list = list;
@@ -644,7 +1035,7 @@
         }
 
         public Node getNamedItem(String name) {
-            for(IIOMetadataNode node:list) {
+            for (IIOMetadataNode node : list) {
                 if (name.equals(node.getNodeName())) {
                     return node;
                 }
@@ -653,11 +1044,13 @@
         }
 
         public Node setNamedItem(Node arg) throws DOMException {
-            throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "This NamedNodeMap is read-only!");
+            throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
+                    "This NamedNodeMap is read-only!");
         }
 
         public Node removeNamedItem(String name) throws DOMException {
-            throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "This NamedNodeMap is read-only!");
+            throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
+                    "This NamedNodeMap is read-only!");
         }
 
         public Node getNamedItemNS(String namespaceURI, String localName) throws DOMException {
@@ -665,11 +1058,13 @@
         }
 
         public Node setNamedItemNS(Node arg) throws DOMException {
-            throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "This NamedNodeMap is read-only!");
+            throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
+                    "This NamedNodeMap is read-only!");
         }
 
         public Node removeNamedItemNS(String namespaceURI, String localName) throws DOMException {
-            throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "This NamedNodeMap is read-only!");
+            throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
+                    "This NamedNodeMap is read-only!");
         }
     }
 }
diff --git a/awt/javax/imageio/metadata/IIOStandardMetadataFormat.java b/awt/javax/imageio/metadata/IIOStandardMetadataFormat.java
index 94d2125..706cb2f 100644
--- a/awt/javax/imageio/metadata/IIOStandardMetadataFormat.java
+++ b/awt/javax/imageio/metadata/IIOStandardMetadataFormat.java
@@ -15,18 +15,19 @@
  *  limitations under the License.
  */
 
-
 package javax.imageio.metadata;
 
 import javax.imageio.ImageTypeSpecifier;
 import java.util.ArrayList;
 
 /**
- * The Class IIOStandardMetadataFormat describes the rules of the 
- * standard metadata format.
+ * The class IIOStandardMetadataFormat describes the rules of the standard
+ * metadata format.
+ * 
+ * @since Android 1.0
  */
-class IIOStandardMetadataFormat  extends IIOMetadataFormatImpl {
-    
+class IIOStandardMetadataFormat extends IIOMetadataFormatImpl {
+
     /**
      * Instantiates a new IIOStandardMetadataFormat.
      */
@@ -41,7 +42,7 @@
     }
 
     /**
-     * Builds the dtd that describes the standard metadata format.
+     * Builds the DTD that describes the standard metadata format.
      */
     private void buildDTD() {
         // CHROMA
@@ -80,7 +81,10 @@
         addAttribute("ColorSpaceType", "name", DATATYPE_STRING, true, null, values);
 
         addElement("NumChannels", "Chroma", CHILD_POLICY_EMPTY);
-        addAttribute("NumChannels", "value", DATATYPE_INTEGER, true, 0, Integer.MAX_VALUE); // list - why?
+        addAttribute("NumChannels", "value", DATATYPE_INTEGER, true, 0, Integer.MAX_VALUE); // list
+        // -
+        // why
+        // ?
 
         addElement("Gamma", "Chroma", CHILD_POLICY_EMPTY);
         addAttribute("Gamma", "value", DATATYPE_FLOAT, true, null);
@@ -142,10 +146,8 @@
         addAttribute("BitsPerSample", "value", DATATYPE_INTEGER, true, 1, Integer.MAX_VALUE); // list
 
         addElement("SignificantBitsPerSample", "Data", CHILD_POLICY_EMPTY);
-        addAttribute(
-                "SignificantBitsPerSample", "value",
-                DATATYPE_INTEGER, true, 1, Integer.MAX_VALUE
-        ); // list
+        addAttribute("SignificantBitsPerSample", "value", DATATYPE_INTEGER, true, 1,
+                Integer.MAX_VALUE); // list
 
         addElement("SampleMSB", "Data", CHILD_POLICY_EMPTY);
         addAttribute("SampleMSB", "value", DATATYPE_INTEGER, true, 1, Integer.MAX_VALUE); // list
@@ -224,49 +226,29 @@
 
         addElement("ImageCreationTime", "Document", CHILD_POLICY_EMPTY);
         addAttribute("ImageCreationTime", "year", DATATYPE_INTEGER, true, null);
-        addAttribute(
-                "ImageCreationTime", "month",
-                DATATYPE_INTEGER, true, null, "1", "12", true, true
-        );
-        addAttribute(
-                "ImageCreationTime", "day",
-                DATATYPE_INTEGER, true, null, "1", "31", true, true
-        );
-        addAttribute(
-                "ImageCreationTime", "hour",
-                DATATYPE_INTEGER, false, "0", "0", "23", true, true
-        );
-        addAttribute(
-                "ImageCreationTime", "minute",
-                DATATYPE_INTEGER, false, "0", "0", "59", true, true
-        );
-        addAttribute(
-                "ImageCreationTime", "second",
-                DATATYPE_INTEGER, false, "0", "0", "60", true, true
-        );
+        addAttribute("ImageCreationTime", "month", DATATYPE_INTEGER, true, null, "1", "12", true,
+                true);
+        addAttribute("ImageCreationTime", "day", DATATYPE_INTEGER, true, null, "1", "31", true,
+                true);
+        addAttribute("ImageCreationTime", "hour", DATATYPE_INTEGER, false, "0", "0", "23", true,
+                true);
+        addAttribute("ImageCreationTime", "minute", DATATYPE_INTEGER, false, "0", "0", "59", true,
+                true);
+        addAttribute("ImageCreationTime", "second", DATATYPE_INTEGER, false, "0", "0", "60", true,
+                true);
 
         addElement("ImageModificationTime", "Document", CHILD_POLICY_EMPTY);
         addAttribute("ImageModificationTime", "year", DATATYPE_INTEGER, true, null);
-        addAttribute(
-                "ImageModificationTime", "month",
-                DATATYPE_INTEGER, true, null, "1", "12", true, true
-        );
-        addAttribute(
-                "ImageModificationTime", "day",
-                DATATYPE_INTEGER, true, null, "1", "31", true, true
-        );
-        addAttribute(
-                "ImageModificationTime", "hour",
-                DATATYPE_INTEGER, false, "0", "0", "23", true, true
-        );
-        addAttribute(
-                "ImageModificationTime", "minute",
-                DATATYPE_INTEGER, false, "0", "0", "59", true, true
-        );
-        addAttribute(
-                "ImageModificationTime", "second",
-                DATATYPE_INTEGER, false, "0", "0", "60", true, true
-        );
+        addAttribute("ImageModificationTime", "month", DATATYPE_INTEGER, true, null, "1", "12",
+                true, true);
+        addAttribute("ImageModificationTime", "day", DATATYPE_INTEGER, true, null, "1", "31", true,
+                true);
+        addAttribute("ImageModificationTime", "hour", DATATYPE_INTEGER, false, "0", "0", "23",
+                true, true);
+        addAttribute("ImageModificationTime", "minute", DATATYPE_INTEGER, false, "0", "0", "59",
+                true, true);
+        addAttribute("ImageModificationTime", "second", DATATYPE_INTEGER, false, "0", "0", "60",
+                true, true);
 
         // TEXT
         addElement("Text", standardMetadataFormatName, 0, Integer.MAX_VALUE); // CHILD_POLICY_REPEAT
@@ -313,4 +295,3 @@
         addAttribute("OpaqueTile", "y", DATATYPE_INTEGER, true, null);
     }
 }
-
diff --git a/awt/javax/imageio/metadata/package.html b/awt/javax/imageio/metadata/package.html
new file mode 100644
index 0000000..29bd51b
--- /dev/null
+++ b/awt/javax/imageio/metadata/package.html
@@ -0,0 +1,8 @@
+<html>
+  <body>
+    <p>
+      This package contains classes which allows to read and write describing metadata of image files.
+    </p>
+  @since Android 1.0
+  </body>
+</html>
diff --git a/awt/javax/imageio/package.html b/awt/javax/imageio/package.html
new file mode 100644
index 0000000..2fd6148
--- /dev/null
+++ b/awt/javax/imageio/package.html
@@ -0,0 +1,8 @@
+<html>
+  <body>
+    <p>
+      This package contains classes and interfaces which provides an Image I/O API. The contained classes and interfaces allow reading and writing image files of different formats.
+    </p>
+  @since Android 1.0
+  </body>
+</html>
diff --git a/awt/javax/imageio/plugins/bmp/BMPImageWriteParam.java b/awt/javax/imageio/plugins/bmp/BMPImageWriteParam.java
index 0cd44db..ecfb20a 100644
--- a/awt/javax/imageio/plugins/bmp/BMPImageWriteParam.java
+++ b/awt/javax/imageio/plugins/bmp/BMPImageWriteParam.java
@@ -15,19 +15,21 @@
  *  limitations under the License.
  */
 
-
 package javax.imageio.plugins.bmp;
 
 import javax.imageio.ImageWriteParam;
 import java.util.Locale;
 
 /**
- * The BMPImageWriteParam class allows encoding an image in
- * BMP format.
+ * The BMPImageWriteParam class allows encoding an image in BMP format.
+ * 
+ * @since Android 1.0
  */
 public class BMPImageWriteParam extends ImageWriteParam {
-    
-    /** The top down. */
+
+    /**
+     * The top down.
+     */
     private boolean topDown; // Default is bottom-up
 
     /**
@@ -41,33 +43,35 @@
     /**
      * Instantiates a new BMPImageWriteParam with the specified Locale.
      * 
-     * @param locale the specified Locale.
+     * @param locale
+     *            the specified Locale.
      */
     public BMPImageWriteParam(Locale locale) {
         super(locale);
 
         // Set the compression
         canWriteCompressed = true;
-        compressionTypes = new String[] {"BI_RGB", "BI_RLE8", "BI_RLE4", "BI_BITFIELDS"};
-        compressionType = compressionTypes[0]; 
+        compressionTypes = new String[] {
+                "BI_RGB", "BI_RLE8", "BI_RLE4", "BI_BITFIELDS"
+        };
+        compressionType = compressionTypes[0];
     }
 
     /**
-     * Sets true if the data will be written in a top-down order, 
-     * false otherwise.
+     * Sets true if the data will be written in a top-down order, false
+     * otherwise.
      * 
-     * @param topDown the new top-down value. 
+     * @param topDown
+     *            the new top-down value.
      */
     public void setTopDown(boolean topDown) {
         this.topDown = topDown;
     }
 
     /**
-     * Returns true if the data is written in top-down order, false
-     * otherwise.
+     * Returns true if the data is written in top-down order, false otherwise.
      * 
-     * @return true if the data is written in top-down order, false
-     * otherwise.
+     * @return true if the data is written in top-down order, false otherwise.
      */
     public boolean isTopDown() {
         return topDown;
diff --git a/awt/javax/imageio/plugins/bmp/package.html b/awt/javax/imageio/plugins/bmp/package.html
new file mode 100644
index 0000000..9494a10
--- /dev/null
+++ b/awt/javax/imageio/plugins/bmp/package.html
@@ -0,0 +1,8 @@
+<html>
+  <body>
+    <p>
+      This package contains auxiliary classes for the built-in BMP image plug-in.
+    </p>
+  @since Android 1.0
+  </body>
+</html>
diff --git a/awt/javax/imageio/plugins/jpeg/JPEGHuffmanTable.java b/awt/javax/imageio/plugins/jpeg/JPEGHuffmanTable.java
index 398c960..67b504b 100644
--- a/awt/javax/imageio/plugins/jpeg/JPEGHuffmanTable.java
+++ b/awt/javax/imageio/plugins/jpeg/JPEGHuffmanTable.java
@@ -18,82 +18,90 @@
 package javax.imageio.plugins.jpeg;
 
 /**
- * The JPEGHuffmanTable class represents a single JPEG Huffman table. 
- * It contains the standard tables from the JPEG specification.
+ * The JPEGHuffmanTable class represents a single JPEG Huffman table. It
+ * contains the standard tables from the JPEG specification.
+ * 
+ * @since Android 1.0
  */
 public class JPEGHuffmanTable {
-    
-    /** The standard DC luminance Huffman table . */
-    public static final JPEGHuffmanTable StdDCLuminance = new JPEGHuffmanTable(
-            new short[] {0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0},
-            new short[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0x0A, 0x0B},
-            false
-    );
 
-    /** The standard DC chrominance Huffman table. */
-    public static final JPEGHuffmanTable StdDCChrominance = new JPEGHuffmanTable(
-            new short[] {0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0},
-            new short[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0x0A, 0x0B},
-            false
-    );
+    /**
+     * The standard DC luminance Huffman table .
+     */
+    public static final JPEGHuffmanTable StdDCLuminance = new JPEGHuffmanTable(new short[] {
+            0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0
+    }, new short[] {
+            0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0x0A, 0x0B
+    }, false);
 
-    /** The standard AC luminance Huffman table. */
-    public static final JPEGHuffmanTable StdACLuminance = new JPEGHuffmanTable(
-            new short[] {0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7D},
-            new short[] {
-                    0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12, 0x21, 0x31, 0x41, 0x06,
-                    0x13, 0x51, 0x61, 0x07, 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xA1, 0x08,
-                    0x23, 0x42, 0xB1, 0xC1, 0x15, 0x52, 0xD1, 0xF0, 0x24, 0x33, 0x62, 0x72,
-                    0x82, 0x09, 0x0A, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x25, 0x26, 0x27, 0x28,
-                    0x29, 0x2A, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x43, 0x44, 0x45,
-                    0x46, 0x47, 0x48, 0x49, 0x4A, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
-                    0x5A, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x73, 0x74, 0x75,
-                    0x76, 0x77, 0x78, 0x79, 0x7A, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
-                    0x8A, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0xA2, 0xA3,
-                    0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6,
-                    0xB7, 0xB8, 0xB9, 0xBA, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9,
-                    0xCA, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xE1, 0xE2,
-                    0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xF1, 0xF2, 0xF3, 0xF4,
-                    0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA
-            },
-            false
-    );
+    /**
+     * The standard DC chrominance Huffman table.
+     */
+    public static final JPEGHuffmanTable StdDCChrominance = new JPEGHuffmanTable(new short[] {
+            0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0
+    }, new short[] {
+            0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0x0A, 0x0B
+    }, false);
 
-    /** 
-     * The standard AC chrominance Huffman table. */
-    public static final JPEGHuffmanTable StdACChrominance = new JPEGHuffmanTable(
-            new short[] {0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77},
-            new short[] {
-                    0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21, 0x31, 0x06, 0x12, 0x41,
-                    0x51, 0x07, 0x61, 0x71, 0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91,
-                    0xA1, 0xB1, 0xC1, 0x09, 0x23, 0x33, 0x52, 0xF0, 0x15, 0x62, 0x72, 0xD1,
-                    0x0A, 0x16, 0x24, 0x34, 0xE1, 0x25, 0xF1, 0x17, 0x18, 0x19, 0x1A, 0x26,
-                    0x27, 0x28, 0x29, 0x2A, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x43, 0x44,
-                    0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
-                    0x59, 0x5A, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x73, 0x74,
-                    0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
-                    0x88, 0x89, 0x8A, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A,
-                    0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xB2, 0xB3, 0xB4,
-                    0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,
-                    0xC8, 0xC9, 0xCA, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA,
-                    0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xF2, 0xF3, 0xF4,
-                    0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA
-            },
-            false
-    );
+    /**
+     * The standard AC luminance Huffman table.
+     */
+    public static final JPEGHuffmanTable StdACLuminance = new JPEGHuffmanTable(new short[] {
+            0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7D
+    }, new short[] {
+            0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12, 0x21, 0x31, 0x41, 0x06, 0x13, 0x51,
+            0x61, 0x07, 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xA1, 0x08, 0x23, 0x42, 0xB1, 0xC1,
+            0x15, 0x52, 0xD1, 0xF0, 0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0A, 0x16, 0x17, 0x18,
+            0x19, 0x1A, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
+            0x3A, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x53, 0x54, 0x55, 0x56, 0x57,
+            0x58, 0x59, 0x5A, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x73, 0x74, 0x75,
+            0x76, 0x77, 0x78, 0x79, 0x7A, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x92,
+            0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7,
+            0xA8, 0xA9, 0xAA, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xC2, 0xC3,
+            0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8,
+            0xD9, 0xDA, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xF1, 0xF2,
+            0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA
+    }, false);
 
-    /** The lengths. */
+    /**
+     * The standard AC chrominance Huffman table.
+     */
+    public static final JPEGHuffmanTable StdACChrominance = new JPEGHuffmanTable(new short[] {
+            0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77
+    }, new short[] {
+            0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21, 0x31, 0x06, 0x12, 0x41, 0x51, 0x07,
+            0x61, 0x71, 0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91, 0xA1, 0xB1, 0xC1, 0x09,
+            0x23, 0x33, 0x52, 0xF0, 0x15, 0x62, 0x72, 0xD1, 0x0A, 0x16, 0x24, 0x34, 0xE1, 0x25,
+            0xF1, 0x17, 0x18, 0x19, 0x1A, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x35, 0x36, 0x37, 0x38,
+            0x39, 0x3A, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x53, 0x54, 0x55, 0x56,
+            0x57, 0x58, 0x59, 0x5A, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x73, 0x74,
+            0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
+            0x8A, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0xA2, 0xA3, 0xA4, 0xA5,
+            0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA,
+            0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6,
+            0xD7, 0xD8, 0xD9, 0xDA, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xF2,
+            0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA
+    }, false);
+
+    /**
+     * The lengths.
+     */
     private short lengths[];
-    
-    /** The values. */
+
+    /**
+     * The values.
+     */
     private short values[];
 
     /**
      * Instantiates a new jPEG huffman table.
      * 
-     * @param lengths the lengths
-     * @param values the values
-     * @param copy the copy
+     * @param lengths
+     *            the lengths
+     * @param values
+     *            the values
+     * @param copy
+     *            the copy
      */
     JPEGHuffmanTable(short[] lengths, short[] values, boolean copy) {
         // Construction of standard tables without checks
@@ -106,9 +114,11 @@
     /**
      * Instantiates a new JPEGHuffmanTable.
      * 
-     * @param lengths the array of shorts lengths.
-     * @param values the array of shorts containing 
-     * the values in order of increasing code length.
+     * @param lengths
+     *            the array of shorts lengths.
+     * @param values
+     *            the array of shorts containing the values in order of
+     *            increasing code length.
      */
     public JPEGHuffmanTable(short[] lengths, short[] values) {
         if (lengths == null) {
@@ -145,8 +155,8 @@
     /**
      * Gets an array of lengths in the Huffman table.
      * 
-     * @return the array of short values representing the
-     * length values in the Huffman table.
+     * @return the array of short values representing the length values in the
+     *         Huffman table.
      */
     public short[] getLengths() {
         short newLengths[] = new short[lengths.length];
@@ -155,8 +165,7 @@
     }
 
     /**
-     * Gets an array of values represented by increasing length of 
-     * their codes.
+     * Gets an array of values represented by increasing length of their codes.
      * 
      * @return the array of values.
      */
@@ -169,8 +178,10 @@
     /**
      * Check huffman table.
      * 
-     * @param lengths the lengths
-     * @param values the values
+     * @param lengths
+     *            the lengths.
+     * @param values
+     *            the values.
      */
     private static void checkHuffmanTable(short[] lengths, short[] values) {
         int numLeaves = 0;
@@ -179,13 +190,15 @@
             numLeaves += length;
             possibleLeaves -= length;
             if (possibleLeaves < 0) {
-                throw new IllegalArgumentException("Invalid Huffman table provided, lengths are incorrect.");
+                throw new IllegalArgumentException(
+                        "Invalid Huffman table provided, lengths are incorrect.");
             }
             possibleLeaves <<= 1;
         }
 
         if (values.length != numLeaves) {
-            throw new IllegalArgumentException("Invalid Huffman table provided, sum of lengths != values.");
+            throw new IllegalArgumentException(
+                    "Invalid Huffman table provided, sum of lengths != values.");
         }
     }
 
diff --git a/awt/javax/imageio/plugins/jpeg/JPEGImageReadParam.java b/awt/javax/imageio/plugins/jpeg/JPEGImageReadParam.java
index dd08d51..2f3a9a8 100644
--- a/awt/javax/imageio/plugins/jpeg/JPEGImageReadParam.java
+++ b/awt/javax/imageio/plugins/jpeg/JPEGImageReadParam.java
@@ -20,18 +20,26 @@
 import javax.imageio.ImageReadParam;
 
 /**
- * The JPEGImageReadParam class provides functionality to set Huffman tables 
- * and quantization tables when using the JPEG reader plug-in.
+ * The JPEGImageReadParam class provides functionality to set Huffman tables and
+ * quantization tables when using the JPEG reader plug-in.
+ * 
+ * @since Android 1.0
  */
 public class JPEGImageReadParam extends ImageReadParam {
-    
-    /** The q tables. */
+
+    /**
+     * The q tables.
+     */
     private JPEGQTable qTables[];
-    
-    /** The dc huffman tables. */
+
+    /**
+     * The dc huffman tables.
+     */
     private JPEGHuffmanTable dcHuffmanTables[];
-    
-    /** The ac huffman tables. */
+
+    /**
+     * The ac huffman tables.
+     */
     private JPEGHuffmanTable acHuffmanTables[];
 
     /**
@@ -43,29 +51,28 @@
     /**
      * Returns true if tables are set, false otherwise.
      * 
-     * @return true if tables are set, false otherwise.
+     * @return true, if tables are set, false otherwise.
      */
     public boolean areTablesSet() {
         return qTables != null;
     }
 
     /**
-     * Sets the quantization and Huffman tables for using in 
-     * decoding streams.
+     * Sets the quantization and Huffman tables for using in decoding streams.
      * 
-     * @param qTables the quantization tables.
-     * @param DCHuffmanTables the standart DC Huffman tables.
-     * @param ACHuffmanTables the standart AC huffman tables.
+     * @param qTables
+     *            the quantization tables.
+     * @param DCHuffmanTables
+     *            the standart DC Huffman tables.
+     * @param ACHuffmanTables
+     *            the standart AC huffman tables.
      */
-    public void setDecodeTables(
-            JPEGQTable[] qTables,
-            JPEGHuffmanTable[] DCHuffmanTables,
-            JPEGHuffmanTable[] ACHuffmanTables
-    ) {
+    public void setDecodeTables(JPEGQTable[] qTables, JPEGHuffmanTable[] DCHuffmanTables,
+            JPEGHuffmanTable[] ACHuffmanTables) {
         if (qTables == null || DCHuffmanTables == null || ACHuffmanTables == null) {
             throw new IllegalArgumentException("Invalid JPEG table arrays");
         }
-        if(DCHuffmanTables.length != ACHuffmanTables.length) {
+        if (DCHuffmanTables.length != ACHuffmanTables.length) {
             throw new IllegalArgumentException("Invalid JPEG table arrays");
         }
         if (qTables.length > 4 || DCHuffmanTables.length > 4) {
@@ -112,5 +119,5 @@
      */
     public JPEGHuffmanTable[] getACHuffmanTables() {
         return acHuffmanTables == null ? null : acHuffmanTables.clone();
-    }    
+    }
 }
diff --git a/awt/javax/imageio/plugins/jpeg/JPEGImageWriteParam.java b/awt/javax/imageio/plugins/jpeg/JPEGImageWriteParam.java
index 34a3cd9..b979911 100644
--- a/awt/javax/imageio/plugins/jpeg/JPEGImageWriteParam.java
+++ b/awt/javax/imageio/plugins/jpeg/JPEGImageWriteParam.java
@@ -23,38 +23,52 @@
 import java.util.Locale;
 
 /**
- * The JPEGImageWriteParam class allows to set JPEG Huffman tables 
- * and quantization when using the JPEG writer plug-in.
+ * The JPEGImageWriteParam class allows to set JPEG Huffman tables and
+ * quantization when using the JPEG writer plug-in.
+ * 
+ * @since Android 1.0
  */
 public class JPEGImageWriteParam extends ImageWriteParam {
-    
-    /** The Constant COMP_QUALITY_VALUES. */
-    private static final float[] COMP_QUALITY_VALUES = {0.05f, 0.75f, 0.95f};
-    
-    /** The Constant COMP_QUALITY_DESCRIPTIONS. */
-    private static final String[] COMP_QUALITY_DESCRIPTIONS = {
-            "Minimum useful",
-            "Visually lossless",
-            "Maximum useful"
+
+    /**
+     * The Constant COMP_QUALITY_VALUES.
+     */
+    private static final float[] COMP_QUALITY_VALUES = {
+            0.05f, 0.75f, 0.95f
     };
 
-    /** The q tables. */
+    /**
+     * The Constant COMP_QUALITY_DESCRIPTIONS.
+     */
+    private static final String[] COMP_QUALITY_DESCRIPTIONS = {
+            "Minimum useful", "Visually lossless", "Maximum useful"
+    };
+
+    /**
+     * The q tables.
+     */
     private JPEGQTable[] qTables;
-    
-    /** The dc huffman tables. */
+
+    /**
+     * The dc huffman tables.
+     */
     private JPEGHuffmanTable[] dcHuffmanTables;
-    
-    /** The ac huffman tables. */
+
+    /**
+     * The ac huffman tables.
+     */
     private JPEGHuffmanTable[] acHuffmanTables;
 
-    /** The optimize huffman tables. */
+    /**
+     * The optimize huffman tables.
+     */
     private boolean optimizeHuffmanTables;
 
     /**
-     * Instantiates a new JPEGImageWriteParam object with 
-     * the specified Locale.
+     * Instantiates a new JPEGImageWriteParam object with the specified Locale.
      * 
-     * @param locale the Locale.
+     * @param locale
+     *            the Locale.
      */
     public JPEGImageWriteParam(Locale locale) {
         super(locale);
@@ -63,37 +77,38 @@
         progressiveMode = ImageWriteParam.MODE_DISABLED;
 
         canWriteCompressed = true;
-        compressionTypes = new String[]{"JPEG"};
-        compressionType = compressionTypes[0]; 
+        compressionTypes = new String[] {
+            "JPEG"
+        };
+        compressionType = compressionTypes[0];
         compressionQuality = JPEGConsts.DEFAULT_JPEG_COMPRESSION_QUALITY;
     }
 
     /**
      * Returns true if tables are set, false otherwise.
      * 
-     * @return true if tables are set, false otherwise.
+     * @return true, if tables are set, false otherwise.
      */
     public boolean areTablesSet() {
         return qTables != null;
     }
 
     /**
-     * Sets the quantization and Huffman tables for using in 
-     * encoding streams.
+     * Sets the quantization and Huffman tables for using in encoding streams.
      * 
-     * @param qTables the quantization tables.
-     * @param DCHuffmanTables the standart DC Huffman tables.
-     * @param ACHuffmanTables the standart AC huffman tables.
+     * @param qTables
+     *            the quantization tables.
+     * @param DCHuffmanTables
+     *            the standart DC Huffman tables.
+     * @param ACHuffmanTables
+     *            the standart AC huffman tables.
      */
-    public void setEncodeTables(
-            JPEGQTable[] qTables,
-            JPEGHuffmanTable[] DCHuffmanTables,
-            JPEGHuffmanTable[] ACHuffmanTables
-    ) {
+    public void setEncodeTables(JPEGQTable[] qTables, JPEGHuffmanTable[] DCHuffmanTables,
+            JPEGHuffmanTable[] ACHuffmanTables) {
         if (qTables == null || DCHuffmanTables == null || ACHuffmanTables == null) {
             throw new IllegalArgumentException("Invalid JPEG table arrays");
         }
-        if(DCHuffmanTables.length != ACHuffmanTables.length) {
+        if (DCHuffmanTables.length != ACHuffmanTables.length) {
             throw new IllegalArgumentException("Invalid JPEG table arrays");
         }
         if (qTables.length > 4 || DCHuffmanTables.length > 4) {
@@ -155,21 +170,22 @@
     }
 
     /**
-     * Sets the flag indicated that the writer will generate optimized 
-     * Huffman tables for the image as part of the writing process.
+     * Sets the flag indicated that the writer will generate optimized Huffman
+     * tables for the image as part of the writing process.
      * 
-     * @param optimize the flag of optimizing huffman tables.
+     * @param optimize
+     *            the flag of optimizing huffman tables.
      */
     public void setOptimizeHuffmanTables(boolean optimize) {
         optimizeHuffmanTables = optimize;
     }
 
     /**
-     * Returns true if the writer generates optimized Huffman tables,
-     * false otherwise.
+     * Returns true if the writer generates optimized Huffman tables, false
+     * otherwise.
      * 
-     * @return the true if the writer generates optimized Huffman tables,
-     * false otherwise.
+     * @return true, if the writer generates optimized Huffman tables, false
+     *         otherwise.
      */
     public boolean getOptimizeHuffmanTables() {
         return optimizeHuffmanTables;
diff --git a/awt/javax/imageio/plugins/jpeg/JPEGQTable.java b/awt/javax/imageio/plugins/jpeg/JPEGQTable.java
index 0c5b37e..3461d46 100644
--- a/awt/javax/imageio/plugins/jpeg/JPEGQTable.java
+++ b/awt/javax/imageio/plugins/jpeg/JPEGQTable.java
@@ -18,88 +18,92 @@
  * @author Rustem V. Rafikov
  * @version $Revision: 1.3 $
  */
+
 package javax.imageio.plugins.jpeg;
 
 /**
- * The JPEGQTable class represents a single JPEG quantization table 
- * and provides for the standard tables taken from the JPEG specification.
+ * The JPEGQTable class represents a single JPEG quantization table and provides
+ * for the standard tables taken from the JPEG specification.
+ * 
+ * @since Android 1.0
  */
 public class JPEGQTable {
 
-    /** The Constant SIZE. */
+    /**
+     * The Constant SIZE.
+     */
     private final static int SIZE = 64;
-    
-    /** The Constant BASELINE_MAX. */
+
+    /**
+     * The Constant BASELINE_MAX.
+     */
     private final static int BASELINE_MAX = 255;
-    
-    /** The Constant MAX. */
+
+    /**
+     * The Constant MAX.
+     */
     private final static int MAX = 32767;
 
-
-    /** The table. */
+    /**
+     * The table.
+     */
     private int[] theTable;
 
     /*
-     * K1 & K2 tables can be found in the JPEG format specification 
-     * at http://www.w3.org/Graphics/JPEG/itu-t81.pdf
+     * K1 & K2 tables can be found in the JPEG format specification at
+     * http://www.w3.org/Graphics/JPEG/itu-t81.pdf
      */
 
-    /** The Constant K1LumTable. */
+    /**
+     * The Constant K1LumTable.
+     */
     private static final int[] K1LumTable = new int[] {
-        16,  11,  10,  16,  24,  40,  51,  61,
-        12,  12,  14,  19,  26,  58,  60,  55,
-        14,  13,  16,  24,  40,  57,  69,  56,
-        14,  17,  22,  29,  51,  87,  80,  62,
-        18,  22,  37,  56,  68,  109, 103, 77,
-        24,  35,  55,  64,  81,  104, 113, 92,
-        49,  64,  78,  87,  103, 121, 120, 101,
-        72,  92,  95,  98,  112, 100, 103, 99
+            16, 11, 10, 16, 24, 40, 51, 61, 12, 12, 14, 19, 26, 58, 60, 55, 14, 13, 16, 24, 40, 57,
+            69, 56, 14, 17, 22, 29, 51, 87, 80, 62, 18, 22, 37, 56, 68, 109, 103, 77, 24, 35, 55,
+            64, 81, 104, 113, 92, 49, 64, 78, 87, 103, 121, 120, 101, 72, 92, 95, 98, 112, 100,
+            103, 99
     };
 
-    /** The Constant K2ChrTable. */
+    /**
+     * The Constant K2ChrTable.
+     */
     private static final int[] K2ChrTable = new int[] {
-        17,  18,  24,  47,  99,  99,  99,  99,
-        18,  21,  26,  66,  99,  99,  99,  99,
-        24,  26,  56,  99,  99,  99,  99,  99,
-        47,  66,  99,  99,  99,  99,  99,  99,
-        99,  99,  99,  99,  99,  99,  99,  99,
-        99,  99,  99,  99,  99,  99,  99,  99,
-        99,  99,  99,  99,  99,  99,  99,  99,
-        99,  99,  99,  99,  99,  99,  99,  99
+            17, 18, 24, 47, 99, 99, 99, 99, 18, 21, 26, 66, 99, 99, 99, 99, 24, 26, 56, 99, 99, 99,
+            99, 99, 47, 66, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
+            99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99
     };
 
-    /** 
-     * The K1Luminance indicates standart table K.1 from JPEG
-     * specification and produces "good" quality output. 
+    /**
+     * The K1Luminance indicates standard table K.1 from JPEG specification and
+     * produces "good" quality output.
      */
     public static final JPEGQTable K1Luminance = new JPEGQTable(K1LumTable);
-    
-    /** 
-     * The K1Div2Luminance indicates K.1 table from JPEG
-     * specification with all elements divided by 2 and produces
-     * "very good" quality output. 
+
+    /**
+     * The K1Div2Luminance indicates K.1 table from JPEG specification with all
+     * elements divided by 2 and produces "very good" quality output.
      */
     public static final JPEGQTable K1Div2Luminance = K1Luminance.getScaledInstance(0.5f, true);
-    
-    /** 
-     * The K2Chrominance indicates K.2 table from JPEG
-     * specification and produces "good" quality output. 
+
+    /**
+     * The K2Chrominance indicates K.2 table from JPEG specification and
+     * produces "good" quality output.
      */
     public static final JPEGQTable K2Chrominance = new JPEGQTable(K2ChrTable);
-    
-    /** 
+
+    /**
      * The Constant K2Div2Chrominance indicates K.2 table from JPEG
-     * specification with all elements divided by 2 and produces
-     * "very good" quality output. 
+     * specification with all elements divided by 2 and produces "very good"
+     * quality output.
      */
     public static final JPEGQTable K2Div2Chrominance = K2Chrominance.getScaledInstance(0.5f, true);;
 
-
     /**
-     * Instantiates a new JPEGQTable from the array, which 
-     * should contain 64 elements in natural order.
+     * Instantiates a new JPEGQTable from the array, which should contain 64
+     * elements in natural order.
      * 
-     * @param table the quantization table.
+     * @param table
+     *            the quantization table.
      */
     public JPEGQTable(int[] table) {
         if (table == null) {
@@ -112,23 +116,22 @@
     }
 
     /**
-     * Gets the current quantization table as an array of int values.
+     * Gets the current quantization table as an array of integer values.
      * 
-     * @return the current quantization table as an array of int values.
+     * @return the current quantization table as an array of integer values.
      */
     public int[] getTable() {
         return theTable.clone();
     }
 
     /**
-     * Gets the scaled instance as quantization table where 
-     * the values are multiplied by the scaleFactor and then clamped 
-     * if forceBaseline is true.
+     * Gets the scaled instance as quantization table where the values are
+     * multiplied by the scaleFactor and then clamped if forceBaseline is true.
      * 
-     * @param scaleFactor the scale factor of table.
-     * @param forceBaseline the force baseline flag, the values 
-     * should be clamped if true.
-     * 
+     * @param scaleFactor
+     *            the scale factor of table.
+     * @param forceBaseline
+     *            the force baseline flag, the values should be clamped if true.
      * @return the new quantization table.
      */
     public JPEGQTable getScaledInstance(float scaleFactor, boolean forceBaseline) {
@@ -156,7 +159,7 @@
      */
     @Override
     public String toString() {
-        //-- TODO more informative info
+        // -- TODO more informative info
         return "JPEGQTable";
     }
 }
diff --git a/awt/javax/imageio/plugins/jpeg/package.html b/awt/javax/imageio/plugins/jpeg/package.html
new file mode 100644
index 0000000..14575c4
--- /dev/null
+++ b/awt/javax/imageio/plugins/jpeg/package.html
@@ -0,0 +1,8 @@
+<html>
+  <body>
+    <p>
+      This package contains auxiliary classes for the built-in JPEG image plug-in.
+    </p>
+  @since Android 1.0
+  </body>
+</html>
diff --git a/awt/javax/imageio/spi/IIORegistry.java b/awt/javax/imageio/spi/IIORegistry.java
index 3c1c989..01ddeaa 100644
--- a/awt/javax/imageio/spi/IIORegistry.java
+++ b/awt/javax/imageio/spi/IIORegistry.java
@@ -18,6 +18,7 @@
  * @author Rustem V. Rafikov
  * @version $Revision: 1.3 $
  */
+
 package javax.imageio.spi;
 
 import java.util.Arrays;
@@ -39,37 +40,41 @@
  */
 
 /**
- * The IIORegistry class registers service provider instances 
- * (SPI). Service provider instances are recognized by specific 
- * meta-information in the JAR files containing them. The JAR
- * files with SPI classes are loaded from the application class 
- * path. 
+ * The IIORegistry class registers service provider instances (SPI). Service
+ * provider instances are recognized by specific meta-information in the JAR
+ * files containing them. The JAR files with SPI classes are loaded from the
+ * application class path.
+ * 
+ * @since Android 1.0
  */
 public final class IIORegistry extends ServiceRegistry {
 
-    /** The instance. */
+    /**
+     * The instance.
+     */
     private static IIORegistry instance;
 
-    /** The Constant CATEGORIES. */
+    /**
+     * The Constant CATEGORIES.
+     */
     private static final Class[] CATEGORIES = new Class[] {
-        javax.imageio.spi.ImageWriterSpi.class,
-        javax.imageio.spi.ImageReaderSpi.class,
-        javax.imageio.spi.ImageInputStreamSpi.class,
-        //javax.imageio.spi.ImageTranscoderSpi.class,
-        javax.imageio.spi.ImageOutputStreamSpi.class
+            javax.imageio.spi.ImageWriterSpi.class, javax.imageio.spi.ImageReaderSpi.class,
+            javax.imageio.spi.ImageInputStreamSpi.class,
+            // javax.imageio.spi.ImageTranscoderSpi.class,
+            javax.imageio.spi.ImageOutputStreamSpi.class
     };
 
     /**
-     * Instantiates a new iIO registry.
+     * Instantiates a new IIO registry.
      */
     private IIORegistry() {
-        super(Arrays.<Class<?>>asList(CATEGORIES).iterator());
+        super(Arrays.<Class<?>> asList(CATEGORIES).iterator());
         registerBuiltinSpis();
         registerApplicationClasspathSpis();
     }
 
     /**
-     * Register builtin spis.
+     * Register built-in SPIs.
      */
     private void registerBuiltinSpis() {
         registerServiceProvider(new JPEGImageWriterSpi());
@@ -80,9 +85,9 @@
         registerServiceProvider(new FileIISSpi());
         registerServiceProvider(new RAFIOSSpi());
         registerServiceProvider(new RAFIISSpi());
-        registerServiceProvider(new OutputStreamIOSSpi());        
+        registerServiceProvider(new OutputStreamIOSSpi());
         registerServiceProvider(new InputStreamIISSpi());
-        //-- TODO implement
+        // -- TODO implement
     }
 
     /**
@@ -91,7 +96,8 @@
      * @return the default IIORegistry instance.
      */
     public static IIORegistry getDefaultInstance() {
-        // TODO implement own instance for each ThreadGroup (see also ThreadLocal)
+        // TODO implement own instance for each ThreadGroup (see also
+        // ThreadLocal)
         synchronized (IIORegistry.class) {
             if (instance == null) {
                 instance = new IIORegistry();
@@ -101,10 +107,9 @@
     }
 
     /**
-     * Registers all service providers from the application class 
-     * path.
+     * Registers all service providers from the application class path.
      */
     public void registerApplicationClasspathSpis() {
-        //-- TODO implement for non-builtin plugins
+        // -- TODO implement for non-builtin plugins
     }
 }
diff --git a/awt/javax/imageio/spi/IIOServiceProvider.java b/awt/javax/imageio/spi/IIOServiceProvider.java
index f5873bf..e947677 100644
--- a/awt/javax/imageio/spi/IIOServiceProvider.java
+++ b/awt/javax/imageio/spi/IIOServiceProvider.java
@@ -18,27 +18,36 @@
  * @author Rustem V. Rafikov
  * @version $Revision: 1.3 $
  */
+
 package javax.imageio.spi;
 
 import java.util.Locale;
 
 /**
- * The IIOServiceProvider abstract class provides base functionality 
- * for imageio service provider interfaces (SPIs). 
+ * The IIOServiceProvider abstract class provides base functionality for ImageIO
+ * service provider interfaces (SPIs).
+ * 
+ * @since Android 1.0
  */
 public abstract class IIOServiceProvider implements RegisterableService {
 
-    /** The vendor name of this service provider. */
+    /**
+     * The vendor name of this service provider.
+     */
     protected String vendorName;
-    
-    /** The version of this service provider. */
+
+    /**
+     * The version of this service provider.
+     */
     protected String version;
 
     /**
      * Instantiates a new IIOServiceProvider.
      * 
-     * @param vendorName the vendor name of service provider.
-     * @param version the version of service provider.
+     * @param vendorName
+     *            the vendor name of service provider.
+     * @param version
+     *            the version of service provider.
      */
     public IIOServiceProvider(String vendorName, String version) {
         if (vendorName == null) {
@@ -85,12 +94,11 @@
     }
 
     /**
-     * Gets a description of this service provider.   
-     * The result string should be localized for the specified 
-     * Locale.
+     * Gets a description of this service provider. The result string should be
+     * localized for the specified Locale.
      * 
-     * @param locale the specified Locale.
-     * 
+     * @param locale
+     *            the specified Locale.
      * @return the description of this service provider.
      */
     public abstract String getDescription(Locale locale);
diff --git a/awt/javax/imageio/spi/ImageInputStreamSpi.java b/awt/javax/imageio/spi/ImageInputStreamSpi.java
index 47d210a..fc859a8 100644
--- a/awt/javax/imageio/spi/ImageInputStreamSpi.java
+++ b/awt/javax/imageio/spi/ImageInputStreamSpi.java
@@ -18,6 +18,7 @@
  * @author Rustem V. Rafikov
  * @version $Revision: 1.3 $
  */
+
 package javax.imageio.spi;
 
 import java.io.File;
@@ -25,13 +26,16 @@
 import javax.imageio.stream.ImageInputStream;
 
 /**
- * The ImageInputStreamSpi abstract class is a service provider 
- * interface (SPI) for ImageInputStreams.  
+ * The ImageInputStreamSpi abstract class is a service provider interface (SPI)
+ * for ImageInputStreams.
+ * 
+ * @since Android 1.0
  */
-public abstract class ImageInputStreamSpi extends IIOServiceProvider implements
-        RegisterableService {
-    
-    /** The input class. */
+public abstract class ImageInputStreamSpi extends IIOServiceProvider implements RegisterableService {
+
+    /**
+     * The input class.
+     */
     protected Class<?> inputClass;
 
     /**
@@ -44,9 +48,12 @@
     /**
      * Instantiates a new ImageInputStreamSpi.
      * 
-     * @param vendorName the vendor name.
-     * @param version the version.
-     * @param inputClass the input class.
+     * @param vendorName
+     *            the vendor name.
+     * @param version
+     *            the version.
+     * @param inputClass
+     *            the input class.
      */
     public ImageInputStreamSpi(String vendorName, String version, Class<?> inputClass) {
         super(vendorName, version);
@@ -54,8 +61,8 @@
     }
 
     /**
-     * Gets an input Class object that represents class or 
-     * interface that must be implemented by an input source.
+     * Gets an input Class object that represents class or interface that must
+     * be implemented by an input source.
      * 
      * @return the input class.
      */
@@ -64,61 +71,59 @@
     }
 
     /**
-     * Returns true if the ImageInputStream can use a cache 
-     * file. If this method returns false, the value of the 
-     * useCache parameter of createInputStreamInstance will 
-     * be ignored. The default implementation returns false.
+     * Returns true if the ImageInputStream can use a cache file. If this method
+     * returns false, the value of the useCache parameter of
+     * createInputStreamInstance will be ignored. The default implementation
+     * returns false.
      * 
-     * @return true if the ImageInputStream can use a cache 
-     * file, false otherwise.
+     * @return true, if the ImageInputStream can use a cache file, false
+     *         otherwise.
      */
     public boolean canUseCacheFile() {
-        return false; //-- def
+        return false; // -- def
     }
 
     /**
-     * Returns true if the ImageInputStream implementation 
-     * requires the use of a cache file. The default implementation 
-     * returns false.
+     * Returns true if the ImageInputStream implementation requires the use of a
+     * cache file. The default implementation returns false.
      * 
-     * @return true if the ImageInputStream implementation 
-     * requires the use of a cache file, false otherwise.
+     * @return true, if the ImageInputStream implementation requires the use of
+     *         a cache file, false otherwise.
      */
     public boolean needsCacheFile() {
         return false; // def
     }
 
     /**
-     * Creates the ImageInputStream associated with this 
-     * service provider. The input object should
-     * be an instance of the class returned by th getInputClass 
-     * method. This method uses the specified directory
-     * for the cache file if the useCache parameter is true. 
+     * Creates the ImageInputStream associated with this service provider. The
+     * input object should be an instance of the class returned by the
+     * getInputClass method. This method uses the specified directory for the
+     * cache file if the useCache parameter is true.
      * 
-     * @param input the input Object.
-     * @param useCache the flag indicating if a cache file 
-     * is needed or not.
-     * @param cacheDir the cache directory.
-     * 
+     * @param input
+     *            the input Object.
+     * @param useCache
+     *            the flag indicating if a cache file is needed or not.
+     * @param cacheDir
+     *            the cache directory.
      * @return the ImageInputStream.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public abstract ImageInputStream createInputStreamInstance(Object input, boolean useCache,
             File cacheDir) throws IOException;
 
     /**
-     * Creates the ImageInputStream associated with this 
-     * service provider. The input object should
-     * be an instance of the class returned by getInputClass 
-     * method. This method uses the default system directory
-     * for the cache file, if it is needed. 
+     * Creates the ImageInputStream associated with this service provider. The
+     * input object should be an instance of the class returned by getInputClass
+     * method. This method uses the default system directory for the cache file,
+     * if it is needed.
      * 
-     * @param input the input Object.
-     * 
+     * @param input
+     *            the input Object.
      * @return the ImageInputStream.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public ImageInputStream createInputStreamInstance(Object input) throws IOException {
         return createInputStreamInstance(input, true, null);
diff --git a/awt/javax/imageio/spi/ImageOutputStreamSpi.java b/awt/javax/imageio/spi/ImageOutputStreamSpi.java
index d45e24c..b7a9a5c 100644
--- a/awt/javax/imageio/spi/ImageOutputStreamSpi.java
+++ b/awt/javax/imageio/spi/ImageOutputStreamSpi.java
@@ -18,6 +18,7 @@
  * @author Rustem V. Rafikov
  * @version $Revision: 1.3 $
  */
+
 package javax.imageio.spi;
 
 import javax.imageio.stream.ImageOutputStream;
@@ -25,13 +26,17 @@
 import java.io.File;
 
 /**
- * The ImageOutputStreamSpi abstract class is a service provider 
- * interface (SPI) for ImageOutputStreams. 
+ * The ImageOutputStreamSpi abstract class is a service provider interface (SPI)
+ * for ImageOutputStreams.
+ * 
+ * @since Android 1.0
  */
 public abstract class ImageOutputStreamSpi extends IIOServiceProvider implements
         RegisterableService {
-    
-    /** The output class. */
+
+    /**
+     * The output class.
+     */
     protected Class<?> outputClass;
 
     /**
@@ -44,9 +49,12 @@
     /**
      * Instantiates a new ImageOutputStreamSpi.
      * 
-     * @param vendorName the vendor name.
-     * @param version the version.
-     * @param outputClass the output class.
+     * @param vendorName
+     *            the vendor name.
+     * @param version
+     *            the version.
+     * @param outputClass
+     *            the output class.
      */
     public ImageOutputStreamSpi(String vendorName, String version, Class<?> outputClass) {
         super(vendorName, version);
@@ -54,8 +62,8 @@
     }
 
     /**
-     * Gets an output Class object that represents the class or 
-     * interface that must be implemented by an output source.
+     * Gets an output Class object that represents the class or interface that
+     * must be implemented by an output source.
      * 
      * @return the output class.
      */
@@ -64,63 +72,61 @@
     }
 
     /**
-     * Returns true if the ImageOutputStream can use a cache 
-     * file. If this method returns false, the value of the 
-     * useCache parameter of createOutputStreamInstance will 
-     * be ignored. The default implementation returns false.
+     * Returns true if the ImageOutputStream can use a cache file. If this
+     * method returns false, the value of the useCache parameter of
+     * createOutputStreamInstance will be ignored. The default implementation
+     * returns false.
      * 
-     * @return true if the ImageOutputStream can use a cache 
-     * file, false otherwise.
+     * @return true, if the ImageOutputStream can use a cache file, false
+     *         otherwise.
      */
     public boolean canUseCacheFile() {
         return false; // def
     }
 
     /**
-     * Returns true if the ImageOutputStream  implementation 
-     * requires the use of a cache file. The default implementation 
-     * returns false.
+     * Returns true if the ImageOutputStream implementation requires the use of
+     * a cache file. The default implementation returns false.
      * 
-     * @return true if the ImageOutputStream  implementation 
-     * requires the use of a cache file, false otherwise.
+     * @return true, if the ImageOutputStream implementation requires the use of
+     *         a cache file, false otherwise.
      */
     public boolean needsCacheFile() {
         return false; // def
     }
 
     /**
-     * Creates the ImageOutputStream associated with this 
-     * service provider. The output object should
-     * be an instance of the class returned by getOutputClass 
-     * method. This method uses the default system directory
-     * for the cache file, if it is needed. 
+     * Creates the ImageOutputStream associated with this service provider. The
+     * output object should be an instance of the class returned by
+     * getOutputClass method. This method uses the default system directory for
+     * the cache file, if it is needed.
      * 
-     * @param output the output Object.
-     * 
+     * @param output
+     *            the output Object.
      * @return the ImageOutputStream.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public ImageOutputStream createOutputStreamInstance(Object output) throws IOException {
         return createOutputStreamInstance(output, true, null);
     }
 
     /**
-     * Creates the ImageOutputStream associated with this 
-     * service provider. The output object should
-     * be an instance of the class returned by getInputClass 
-     * method. This method uses the specified directory
-     * for the cache file, if the useCache parameter is true. 
+     * Creates the ImageOutputStream associated with this service provider. The
+     * output object should be an instance of the class returned by
+     * getInputClass method. This method uses the specified directory for the
+     * cache file, if the useCache parameter is true.
      * 
-     * @param output the output Object.
-     * @param useCache the flag indicating if cache file 
-     * is needed or not.
-     * @param cacheDir the cache directory.
-     * 
+     * @param output
+     *            the output Object.
+     * @param useCache
+     *            the flag indicating if cache file is needed or not.
+     * @param cacheDir
+     *            the cache directory.
      * @return the ImageOutputStream.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
-    public abstract ImageOutputStream createOutputStreamInstance(Object output,
-            boolean useCache, File cacheDir) throws IOException;
+    public abstract ImageOutputStream createOutputStreamInstance(Object output, boolean useCache,
+            File cacheDir) throws IOException;
 }
diff --git a/awt/javax/imageio/spi/ImageReaderSpi.java b/awt/javax/imageio/spi/ImageReaderSpi.java
index 2e2484c..0528d25 100644
--- a/awt/javax/imageio/spi/ImageReaderSpi.java
+++ b/awt/javax/imageio/spi/ImageReaderSpi.java
@@ -18,6 +18,7 @@
  * @author Rustem V. Rafikov
  * @version $Revision: 1.3 $
  */
+
 package javax.imageio.spi;
 
 import javax.imageio.stream.ImageInputStream;
@@ -25,20 +26,28 @@
 import java.io.IOException;
 
 /**
- * The ImageReaderSpi abstract class is a service provider 
- * interface (SPI) for ImageReaders.
+ * The ImageReaderSpi abstract class is a service provider interface (SPI) for
+ * ImageReaders.
+ * 
+ * @since Android 1.0
  */
 public abstract class ImageReaderSpi extends ImageReaderWriterSpi {
 
-    /** 
-     * The STANDARD_INPUT_TYPE contains ImageInputStream.class. 
+    /**
+     * The STANDARD_INPUT_TYPE contains ImageInputStream.class.
      */
-    public static final Class[] STANDARD_INPUT_TYPE = new Class[] {ImageInputStream.class};
+    public static final Class[] STANDARD_INPUT_TYPE = new Class[] {
+        ImageInputStream.class
+    };
 
-    /** The input types. */
+    /**
+     * The input types.
+     */
     protected Class[] inputTypes;
-    
-    /** The writer SPI names. */
+
+    /**
+     * The writer SPI names.
+     */
     protected String[] writerSpiNames;
 
     /**
@@ -51,49 +60,62 @@
     /**
      * Instantiates a new ImageReaderSpi.
      * 
-     * @param vendorName the vendor name.
-     * @param version the version.
-     * @param names the format names.
-     * @param suffixes the array of strings representing the file suffixes. 
-     * @param MIMETypes the an array of strings representing MIME types.
-     * @param pluginClassName the plugin class name.
-     * @param inputTypes the input types.
-     * @param writerSpiNames the array of strings with class names of all 
-     * associated ImageWriters.
-     * @param supportsStandardStreamMetadataFormat the value indicating
-     * if stream metadata can be described by standart metadata format.
-     * @param nativeStreamMetadataFormatName the native stream metadata 
-     * format name, returned by getNativeStreamMetadataFormatName.
-     * @param nativeStreamMetadataFormatClassName the native stream 
-     * metadata format class name, returned by getNativeStreamMetadataFormat.
-     * @param extraStreamMetadataFormatNames the extra stream metadata 
-     * format names, returned by getExtraStreamMetadataFormatNames.
-     * @param extraStreamMetadataFormatClassNames the extra stream metadata 
-     * format class names, returned by getStreamMetadataFormat.
-     * @param supportsStandardImageMetadataFormat the value indicating
-     * if image metadata can be described by standart metadata format.
-     * @param nativeImageMetadataFormatName the native image metadata 
-     * format name, returned by getNativeImageMetadataFormatName.
-     * @param nativeImageMetadataFormatClassName the native image
-     * metadata format class name, returned by getNativeImageMetadataFormat.
-     * @param extraImageMetadataFormatNames the extra image metadata 
-     * format names, returned by getExtraImageMetadataFormatNames.
-     * @param extraImageMetadataFormatClassNames the extra image metadata 
-     * format class names, returned by getImageMetadataFormat.
+     * @param vendorName
+     *            the vendor name.
+     * @param version
+     *            the version.
+     * @param names
+     *            the format names.
+     * @param suffixes
+     *            the array of strings representing the file suffixes.
+     * @param MIMETypes
+     *            the an array of strings representing MIME types.
+     * @param pluginClassName
+     *            the plug-in class name.
+     * @param inputTypes
+     *            the input types.
+     * @param writerSpiNames
+     *            the array of strings with class names of all associated
+     *            ImageWriters.
+     * @param supportsStandardStreamMetadataFormat
+     *            the value indicating if stream metadata can be described by
+     *            standard metadata format.
+     * @param nativeStreamMetadataFormatName
+     *            the native stream metadata format name, returned by
+     *            getNativeStreamMetadataFormatName.
+     * @param nativeStreamMetadataFormatClassName
+     *            the native stream metadata format class name, returned by
+     *            getNativeStreamMetadataFormat.
+     * @param extraStreamMetadataFormatNames
+     *            the extra stream metadata format names, returned by
+     *            getExtraStreamMetadataFormatNames.
+     * @param extraStreamMetadataFormatClassNames
+     *            the extra stream metadata format class names, returned by
+     *            getStreamMetadataFormat.
+     * @param supportsStandardImageMetadataFormat
+     *            the value indicating if image metadata can be described by
+     *            standard metadata format.
+     * @param nativeImageMetadataFormatName
+     *            the native image metadata format name, returned by
+     *            getNativeImageMetadataFormatName.
+     * @param nativeImageMetadataFormatClassName
+     *            the native image metadata format class name, returned by
+     *            getNativeImageMetadataFormat.
+     * @param extraImageMetadataFormatNames
+     *            the extra image metadata format names, returned by
+     *            getExtraImageMetadataFormatNames.
+     * @param extraImageMetadataFormatClassNames
+     *            the extra image metadata format class names, returned by
+     *            getImageMetadataFormat.
      */
     public ImageReaderSpi(String vendorName, String version, String[] names, String[] suffixes,
-                             String[] MIMETypes, String pluginClassName,
-                             Class[] inputTypes, String[] writerSpiNames,
-                             boolean supportsStandardStreamMetadataFormat,
-                             String nativeStreamMetadataFormatName,
-                             String nativeStreamMetadataFormatClassName,
-                             String[] extraStreamMetadataFormatNames,
-                             String[] extraStreamMetadataFormatClassNames,
-                             boolean supportsStandardImageMetadataFormat,
-                             String nativeImageMetadataFormatName,
-                             String nativeImageMetadataFormatClassName,
-                             String[] extraImageMetadataFormatNames,
-                             String[] extraImageMetadataFormatClassNames) {
+            String[] MIMETypes, String pluginClassName, Class[] inputTypes,
+            String[] writerSpiNames, boolean supportsStandardStreamMetadataFormat,
+            String nativeStreamMetadataFormatName, String nativeStreamMetadataFormatClassName,
+            String[] extraStreamMetadataFormatNames, String[] extraStreamMetadataFormatClassNames,
+            boolean supportsStandardImageMetadataFormat, String nativeImageMetadataFormatName,
+            String nativeImageMetadataFormatClassName, String[] extraImageMetadataFormatNames,
+            String[] extraImageMetadataFormatClassNames) {
         super(vendorName, version, names, suffixes, MIMETypes, pluginClassName,
                 supportsStandardStreamMetadataFormat, nativeStreamMetadataFormatName,
                 nativeStreamMetadataFormatClassName, extraStreamMetadataFormatNames,
@@ -109,8 +131,8 @@
     }
 
     /**
-     * Gets an array of Class objects whose types can be used 
-     * as input for this reader.
+     * Gets an array of Class objects whose types can be used as input for this
+     * reader.
      * 
      * @return the input types.
      */
@@ -119,66 +141,62 @@
     }
 
     /**
-     * Returns true if the format of source object is
-     * supported by this reader.
+     * Returns true if the format of source object is supported by this reader.
      * 
-     * @param source the source object to be decoded 
-     * (for example an ImageInputStream).
-     * 
-     * @return true if the format of source object is
-     * supported by this reader, false otherwise.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param source
+     *            the source object to be decoded (for example an
+     *            ImageInputStream).
+     * @return true, if the format of source object is supported by this reader,
+     *         false otherwise.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public abstract boolean canDecodeInput(Object source) throws IOException;
 
     /**
-     * Returns an instance of the ImageReader implementation for
-     * this service provider.
+     * Returns an instance of the ImageReader implementation for this service
+     * provider.
      * 
      * @return the ImageReader.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public ImageReader createReaderInstance() throws IOException {
         return createReaderInstance(null);
     }
 
     /**
-     * Returns an instance of the ImageReader implementation for
-     * this service provider.
+     * Returns an instance of the ImageReader implementation for this service
+     * provider.
      * 
-     * @param extension the a plugin specific extension object, or null.
-     * 
+     * @param extension
+     *            the a plug-in specific extension object, or null.
      * @return the ImageReader.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public abstract ImageReader createReaderInstance(Object extension) throws IOException;
 
     /**
-     * Checks whether or not the specified ImageReader object 
-     * is an instance of the ImageReader associated with this 
-     * service provider or not.
+     * Checks whether or not the specified ImageReader object is an instance of
+     * the ImageReader associated with this service provider or not.
      * 
-     * @param reader the ImageReader.
-     * 
-     * @return true, if the specified ImageReader object 
-     * is an instance of the ImageReader associated with this 
-     * service provider, false otherwise.
+     * @param reader
+     *            the ImageReader.
+     * @return true, if the specified ImageReader object is an instance of the
+     *         ImageReader associated with this service provider, false
+     *         otherwise.
      */
     public boolean isOwnReader(ImageReader reader) {
         throw new UnsupportedOperationException("Not supported yet");
     }
 
     /**
-     * Gets an array of strings with names of the ImageWriterSpi 
-     * classes that support the internal metadata representation 
-     * used by the ImageReader of this service provider, or null if 
-     * there are no such ImageWriters.
+     * Gets an array of strings with names of the ImageWriterSpi classes that
+     * support the internal metadata representation used by the ImageReader of
+     * this service provider, or null if there are no such ImageWriters.
      * 
-     * @return an array of strings with names of the ImageWriterSpi 
-     * classes.
+     * @return the array of strings with names of the ImageWriterSpi classes.
      */
     public String[] getImageWriterSpiNames() {
         throw new UnsupportedOperationException("Not supported yet");
diff --git a/awt/javax/imageio/spi/ImageReaderWriterSpi.java b/awt/javax/imageio/spi/ImageReaderWriterSpi.java
index b3c0f92..9ca08b5 100644
--- a/awt/javax/imageio/spi/ImageReaderWriterSpi.java
+++ b/awt/javax/imageio/spi/ImageReaderWriterSpi.java
@@ -18,6 +18,7 @@
  * @author Rustem V. Rafikov
  * @version $Revision: 1.3 $
  */
+
 package javax.imageio.spi;
 
 import org.apache.harmony.x.imageio.metadata.IIOMetadataUtils;
@@ -25,97 +26,138 @@
 import javax.imageio.metadata.IIOMetadataFormat;
 
 /**
- * The ImageReaderWriterSpi class is a superclass for the 
- * ImageReaderSpi and ImageWriterSpi SPIs.
+ * The ImageReaderWriterSpi class is a superclass for the ImageReaderSpi and
+ * ImageWriterSpi SPIs.
+ * 
+ * @since Android 1.0
  */
-public abstract class ImageReaderWriterSpi extends IIOServiceProvider
-        implements RegisterableService {
+public abstract class ImageReaderWriterSpi extends IIOServiceProvider implements
+        RegisterableService {
 
-    /** The names. */
+    /**
+     * The names.
+     */
     protected String[] names;
-    
-    /** The suffixes. */
+
+    /**
+     * The suffixes.
+     */
     protected String[] suffixes;
-    
-    /** The MIME types. */
+
+    /**
+     * The MIME types.
+     */
     protected String[] MIMETypes;
-    
-    /** The plugin class name. */
+
+    /**
+     * The plug-in class name.
+     */
     protected String pluginClassName;
-    
-    /** Whether the reader/writer supports standard stream metadata format. */
+
+    /**
+     * Whether the reader/writer supports standard stream metadata format.
+     */
     protected boolean supportsStandardStreamMetadataFormat;
-    
-    /** The native stream metadata format name. */
+
+    /**
+     * The native stream metadata format name.
+     */
     protected String nativeStreamMetadataFormatName;
-    
-    /** The native stream metadata format class name. */
+
+    /**
+     * The native stream metadata format class name.
+     */
     protected String nativeStreamMetadataFormatClassName;
-    
-    /** The extra stream metadata format names. */
+
+    /**
+     * The extra stream metadata format names.
+     */
     protected String[] extraStreamMetadataFormatNames;
-    
-    /** The extra stream metadata format class names. */
+
+    /**
+     * The extra stream metadata format class names.
+     */
     protected String[] extraStreamMetadataFormatClassNames;
-    
-    /** Whether the reader/writer supports standard image metadata format. */
+
+    /**
+     * Whether the reader/writer supports standard image metadata format.
+     */
     protected boolean supportsStandardImageMetadataFormat;
-    
-    /** The native image metadata format name. */
+
+    /**
+     * The native image metadata format name.
+     */
     protected String nativeImageMetadataFormatName;
-    
-    /** The native image metadata format class name. */
+
+    /**
+     * The native image metadata format class name.
+     */
     protected String nativeImageMetadataFormatClassName;
-    
-    /** The extra image metadata format names. */
+
+    /**
+     * The extra image metadata format names.
+     */
     protected String[] extraImageMetadataFormatNames;
-    
-    /** The extra image metadata format class names. */
+
+    /**
+     * The extra image metadata format class names.
+     */
     protected String[] extraImageMetadataFormatClassNames;
 
     /**
      * Instantiates a new ImageReaderWriterSpi.
      * 
-     * @param vendorName the vendor name.
-     * @param version the version.
-     * @param names the format names.
-     * @param suffixes the array of strings representing the file suffixes. 
-     * @param MIMETypes the an array of strings representing MIME types.
-     * @param pluginClassName the plugin class name.
-     * @param supportsStandardStreamMetadataFormat the value indicating
-     * if stream metadata can be described by standart metadata format.
-     * @param nativeStreamMetadataFormatName the native stream metadata 
-     * format name, returned by getNativeStreamMetadataFormatName.
-     * @param nativeStreamMetadataFormatClassName the native stream 
-     * metadata format class name, returned by getNativeStreamMetadataFormat.
-     * @param extraStreamMetadataFormatNames the extra stream metadata 
-     * format names, returned by getExtraStreamMetadataFormatNames.
-     * @param extraStreamMetadataFormatClassNames the extra stream metadata 
-     * format class names, returned by getStreamMetadataFormat.
-     * @param supportsStandardImageMetadataFormat the value indicating
-     * if image metadata can be described by standard metadata format.
-     * @param nativeImageMetadataFormatName the native image metadata 
-     * format name, returned by getNativeImageMetadataFormatName.
-     * @param nativeImageMetadataFormatClassName the native image
-     * metadata format class name, returned by getNativeImageMetadataFormat.
-     * @param extraImageMetadataFormatNames the extra image metadata 
-     * format names, returned by getExtraImageMetadataFormatNames.
-     * @param extraImageMetadataFormatClassNames the extra image metadata 
-     * format class names, returned by getImageMetadataFormat.
+     * @param vendorName
+     *            the vendor name.
+     * @param version
+     *            the version.
+     * @param names
+     *            the format names.
+     * @param suffixes
+     *            the array of strings representing the file suffixes.
+     * @param MIMETypes
+     *            the an array of strings representing MIME types.
+     * @param pluginClassName
+     *            the plug-in class name.
+     * @param supportsStandardStreamMetadataFormat
+     *            the value indicating if stream metadata can be described by
+     *            standard metadata format.
+     * @param nativeStreamMetadataFormatName
+     *            the native stream metadata format name, returned by
+     *            getNativeStreamMetadataFormatName.
+     * @param nativeStreamMetadataFormatClassName
+     *            the native stream metadata format class name, returned by
+     *            getNativeStreamMetadataFormat.
+     * @param extraStreamMetadataFormatNames
+     *            the extra stream metadata format names, returned by
+     *            getExtraStreamMetadataFormatNames.
+     * @param extraStreamMetadataFormatClassNames
+     *            the extra stream metadata format class names, returned by
+     *            getStreamMetadataFormat.
+     * @param supportsStandardImageMetadataFormat
+     *            the value indicating if image metadata can be described by
+     *            standard metadata format.
+     * @param nativeImageMetadataFormatName
+     *            the native image metadata format name, returned by
+     *            getNativeImageMetadataFormatName.
+     * @param nativeImageMetadataFormatClassName
+     *            the native image metadata format class name, returned by
+     *            getNativeImageMetadataFormat.
+     * @param extraImageMetadataFormatNames
+     *            the extra image metadata format names, returned by
+     *            getExtraImageMetadataFormatNames.
+     * @param extraImageMetadataFormatClassNames
+     *            the extra image metadata format class names, returned by
+     *            getImageMetadataFormat.
      */
     public ImageReaderWriterSpi(String vendorName, String version, String[] names,
-                                String[] suffixes, String[] MIMETypes,
-                                String pluginClassName,
-                                boolean supportsStandardStreamMetadataFormat,
-                                String nativeStreamMetadataFormatName,
-                                String nativeStreamMetadataFormatClassName,
-                                String[] extraStreamMetadataFormatNames,
-                                String[] extraStreamMetadataFormatClassNames,
-                                boolean supportsStandardImageMetadataFormat,
-                                String nativeImageMetadataFormatName,
-                                String nativeImageMetadataFormatClassName,
-                                String[] extraImageMetadataFormatNames,
-                                String[] extraImageMetadataFormatClassNames) {
+            String[] suffixes, String[] MIMETypes, String pluginClassName,
+            boolean supportsStandardStreamMetadataFormat, String nativeStreamMetadataFormatName,
+            String nativeStreamMetadataFormatClassName, String[] extraStreamMetadataFormatNames,
+            String[] extraStreamMetadataFormatClassNames,
+            boolean supportsStandardImageMetadataFormat, String nativeImageMetadataFormatName,
+            String nativeImageMetadataFormatClassName, String[] extraImageMetadataFormatNames,
+            String[] extraImageMetadataFormatClassNames) {
         super(vendorName, version);
 
         if (names == null || names.length == 0) {
@@ -137,60 +179,54 @@
         this.nativeStreamMetadataFormatName = nativeStreamMetadataFormatName;
         this.nativeStreamMetadataFormatClassName = nativeStreamMetadataFormatClassName;
 
-        this.extraStreamMetadataFormatNames =
-                extraStreamMetadataFormatNames == null ?
-                null : extraStreamMetadataFormatNames.clone();
+        this.extraStreamMetadataFormatNames = extraStreamMetadataFormatNames == null ? null
+                : extraStreamMetadataFormatNames.clone();
 
-        this.extraStreamMetadataFormatClassNames =
-                extraStreamMetadataFormatClassNames == null ?
-                null : extraStreamMetadataFormatClassNames.clone();
+        this.extraStreamMetadataFormatClassNames = extraStreamMetadataFormatClassNames == null ? null
+                : extraStreamMetadataFormatClassNames.clone();
 
         this.supportsStandardImageMetadataFormat = supportsStandardImageMetadataFormat;
         this.nativeImageMetadataFormatName = nativeImageMetadataFormatName;
         this.nativeImageMetadataFormatClassName = nativeImageMetadataFormatClassName;
 
-        this.extraImageMetadataFormatNames =
-                extraImageMetadataFormatNames == null ?
-                null : extraImageMetadataFormatNames.clone();
+        this.extraImageMetadataFormatNames = extraImageMetadataFormatNames == null ? null
+                : extraImageMetadataFormatNames.clone();
 
-        this.extraImageMetadataFormatClassNames =
-                extraImageMetadataFormatClassNames == null ?
-                null : extraImageMetadataFormatClassNames.clone();
+        this.extraImageMetadataFormatClassNames = extraImageMetadataFormatClassNames == null ? null
+                : extraImageMetadataFormatClassNames.clone();
     }
 
     /**
      * Instantiates a new ImageReaderWriterSpi.
      */
-    public ImageReaderWriterSpi() {}
+    public ImageReaderWriterSpi() {
+    }
 
     /**
-     * Gets an array of strings representing names of the formats 
-     * that can be used by the ImageReader 
-     * or ImageWriter implementation associated with this service 
-     * provider. 
+     * Gets an array of strings representing names of the formats that can be
+     * used by the ImageReader or ImageWriter implementation associated with
+     * this service provider.
      * 
-     * @return an array of supported format names.
+     * @return the array of supported format names.
      */
     public String[] getFormatNames() {
         return names.clone();
     }
 
     /**
-     * Gets an array of strings representing file suffixes 
-     * associated with the formats that can be used by the 
-     * ImageReader or ImageWriter implementation of this
-     * service provider.
+     * Gets an array of strings representing file suffixes associated with the
+     * formats that can be used by the ImageReader or ImageWriter implementation
+     * of this service provider.
      * 
-     * @return an array of file suffixes.
+     * @return the array of file suffixes.
      */
     public String[] getFileSuffixes() {
         return suffixes == null ? null : suffixes.clone();
     }
 
     /**
-     * Gets an array of strings with the names of 
-     * additional formats of the image metadata objects 
-     * produced or consumed by this plug-in.
+     * Gets an array of strings with the names of additional formats of the
+     * image metadata objects produced or consumed by this plug-in.
      * 
      * @return the array of extra image metadata format names.
      */
@@ -199,52 +235,49 @@
     }
 
     /**
-     * Gets an array of strings with the names of 
-     * additional formats of the stream metadata objects 
-     * produced or consumed by this plug-in.
+     * Gets an array of strings with the names of additional formats of the
+     * stream metadata objects produced or consumed by this plug-in.
      * 
      * @return the array of extra stream metadata format names.
      */
     public String[] getExtraStreamMetadataFormatNames() {
-        return extraStreamMetadataFormatNames == null ? null : extraStreamMetadataFormatNames.clone();
+        return extraStreamMetadataFormatNames == null ? null : extraStreamMetadataFormatNames
+                .clone();
     }
 
     /**
-     * Gets an IIOMetadataFormat object for the specified image 
-     * metadata format name. 
+     * Gets an IIOMetadataFormat object for the specified image metadata format
+     * name.
      * 
-     * @param formatName the format name.
-     * 
+     * @param formatName
+     *            the format name.
      * @return the IIOMetadataFormat, or null.
      */
     public IIOMetadataFormat getImageMetadataFormat(String formatName) {
-        return IIOMetadataUtils.instantiateMetadataFormat(
-                formatName, supportsStandardImageMetadataFormat,
-                nativeImageMetadataFormatName, nativeImageMetadataFormatClassName,
-                extraImageMetadataFormatNames, extraImageMetadataFormatClassNames
-        );
+        return IIOMetadataUtils.instantiateMetadataFormat(formatName,
+                supportsStandardImageMetadataFormat, nativeImageMetadataFormatName,
+                nativeImageMetadataFormatClassName, extraImageMetadataFormatNames,
+                extraImageMetadataFormatClassNames);
     }
 
     /**
-     * Gets an IIOMetadataFormat object for the specified stream 
-     * metadata format name. 
+     * Gets an IIOMetadataFormat object for the specified stream metadata format
+     * name.
      * 
-     * @param formatName the format name.
-     * 
+     * @param formatName
+     *            the format name.
      * @return the IIOMetadataFormat, or null.
      */
     public IIOMetadataFormat getStreamMetadataFormat(String formatName) {
-        return IIOMetadataUtils.instantiateMetadataFormat(
-                formatName, supportsStandardStreamMetadataFormat,
-                nativeStreamMetadataFormatName, nativeStreamMetadataFormatClassName,
-                extraStreamMetadataFormatNames, extraStreamMetadataFormatClassNames
-        );
+        return IIOMetadataUtils.instantiateMetadataFormat(formatName,
+                supportsStandardStreamMetadataFormat, nativeStreamMetadataFormatName,
+                nativeStreamMetadataFormatClassName, extraStreamMetadataFormatNames,
+                extraStreamMetadataFormatClassNames);
     }
 
     /**
-     * Gets an array of strings representing the MIME types 
-     * of the formats that are supported by the 
-     * ImageReader or ImageWriter implementation of this 
+     * Gets an array of strings representing the MIME types of the formats that
+     * are supported by the ImageReader or ImageWriter implementation of this
      * service provider.
      * 
      * @return the array MIME types.
@@ -254,32 +287,30 @@
     }
 
     /**
-     * Gets the name of the native image metadata format for 
-     * this reader/writer, which allows for lossless encoding
-     * or decoding of the image metadata with the format.
+     * Gets the name of the native image metadata format for this reader/writer,
+     * which allows for lossless encoding or decoding of the image metadata with
+     * the format.
      * 
-     * @return the string with native image metadata format name, 
-     * or null.
+     * @return the string with native image metadata format name, or null.
      */
     public String getNativeImageMetadataFormatName() {
         return nativeImageMetadataFormatName;
     }
 
     /**
-     * Gets the name of the native stream metadata format for 
-     * this reader/writer, which allows for lossless encoding
-     * or decoding of the stream metadata with the format.
+     * Gets the name of the native stream metadata format for this
+     * reader/writer, which allows for lossless encoding or decoding of the
+     * stream metadata with the format.
      * 
-     * @return the string with native stream metadata format name, 
-     * or null.
+     * @return the string with native stream metadata format name, or null.
      */
     public String getNativeStreamMetadataFormatName() {
         return nativeStreamMetadataFormatName;
     }
 
     /**
-     * Gets the class name of the ImageReader 
-     * or ImageWriter associated with this service provider.
+     * Gets the class name of the ImageReader or ImageWriter associated with
+     * this service provider.
      * 
      * @return the class name.
      */
@@ -288,26 +319,24 @@
     }
 
     /**
-     * Checks if the standard metadata format is supported 
-     * by the getAsTree and setFromTree methods for the 
-     * image metadata objects produced or consumed by this 
-     * reader or writer.
+     * Checks if the standard metadata format is supported by the getAsTree and
+     * setFromTree methods for the image metadata objects produced or consumed
+     * by this reader or writer.
      * 
-     * @return true, if standard image metadata format is 
-     * supported, false otherwise.
+     * @return true, if standard image metadata format is supported, false
+     *         otherwise.
      */
     public boolean isStandardImageMetadataFormatSupported() {
         return supportsStandardImageMetadataFormat;
     }
 
     /**
-     * Checks if the standard metadata format is supported 
-     * by the getAsTree and setFromTree methods for the 
-     * stream metadata objects produced or consumed by this 
-     * reader or writer.
+     * Checks if the standard metadata format is supported by the getAsTree and
+     * setFromTree methods for the stream metadata objects produced or consumed
+     * by this reader or writer.
      * 
-     * @return true, if standard stream metadata format is 
-     * supported, false otherwise.
+     * @return true, if standard stream metadata format is supported, false
+     *         otherwise.
      */
     public boolean isStandardStreamMetadataFormatSupported() {
         return supportsStandardStreamMetadataFormat;
diff --git a/awt/javax/imageio/spi/ImageTranscoderSpi.java b/awt/javax/imageio/spi/ImageTranscoderSpi.java
index 68c4024..742af19 100644
--- a/awt/javax/imageio/spi/ImageTranscoderSpi.java
+++ b/awt/javax/imageio/spi/ImageTranscoderSpi.java
@@ -18,16 +18,18 @@
  * @author Rustem V. Rafikov
  * @version $Revision: 1.3 $
  */
+
 package javax.imageio.spi;
 
 import javax.imageio.ImageTranscoder;
 
 /**
- * The ImageTranscoderSpi class is a service provider interface (SPI) 
- * for ImageTranscoders.
+ * The ImageTranscoderSpi class is a service provider interface (SPI) for
+ * ImageTranscoders.
+ * 
+ * @since Android 1.0
  */
-public abstract class ImageTranscoderSpi extends IIOServiceProvider
-        implements RegisterableService {
+public abstract class ImageTranscoderSpi extends IIOServiceProvider implements RegisterableService {
 
     /**
      * Instantiates a new ImageTranscoderSpi.
@@ -36,37 +38,37 @@
     }
 
     /**
-     * Instantiates a new ImageTranscoderSpi with the specified
-     * vendor name and version.
+     * Instantiates a new ImageTranscoderSpi with the specified vendor name and
+     * version.
      * 
-     * @param vendorName the vendor name.
-     * @param version the version.
+     * @param vendorName
+     *            the vendor name.
+     * @param version
+     *            the version.
      */
     public ImageTranscoderSpi(String vendorName, String version) {
         super(vendorName, version);
     }
 
     /**
-     * Gets the class name of an ImageReaderSpi that 
-     * produces IIOMetadata objects that can be used as 
-     * input to this transcoder.
+     * Gets the class name of an ImageReaderSpi that produces IIOMetadata
+     * objects that can be used as input to this transcoder.
      * 
      * @return the class name of an ImageReaderSpi.
      */
     public abstract String getReaderServiceProviderName();
 
     /**
-     * Gets the class name of an ImageWriterSpi that 
-     * produces IIOMetadata objects that can be used as 
-     * input to this transcoder.
+     * Gets the class name of an ImageWriterSpi that produces IIOMetadata
+     * objects that can be used as input to this transcoder.
      * 
      * @return the class name of an ImageWriterSpi.
      */
     public abstract String getWriterServiceProviderName();
 
     /**
-     * Creates an instance of the ImageTranscoder associated 
-     * with this service provider.
+     * Creates an instance of the ImageTranscoder associated with this service
+     * provider.
      * 
      * @return the ImageTranscoder instance.
      */
diff --git a/awt/javax/imageio/spi/ImageWriterSpi.java b/awt/javax/imageio/spi/ImageWriterSpi.java
index 979ef77..bf25455 100644
--- a/awt/javax/imageio/spi/ImageWriterSpi.java
+++ b/awt/javax/imageio/spi/ImageWriterSpi.java
@@ -18,6 +18,7 @@
  * @author Rustem V. Rafikov
  * @version $Revision: 1.3 $
  */
+
 package javax.imageio.spi;
 
 import javax.imageio.stream.ImageInputStream;
@@ -27,18 +28,28 @@
 import java.io.IOException;
 
 /**
- * The ImageWriterSpi abstract class is a service provider 
- * interface (SPI) for ImageWriters.
+ * The ImageWriterSpi abstract class is a service provider interface (SPI) for
+ * ImageWriters.
+ * 
+ * @since Android 1.0
  */
 public abstract class ImageWriterSpi extends ImageReaderWriterSpi {
 
-    /** The STANDARD_OUTPUT_TYPE contains ImageInputStream.class. */
-    public static final Class[] STANDARD_OUTPUT_TYPE = new Class[] {ImageInputStream.class};
+    /**
+     * The STANDARD_OUTPUT_TYPE contains ImageInputStream.class.
+     */
+    public static final Class[] STANDARD_OUTPUT_TYPE = new Class[] {
+        ImageInputStream.class
+    };
 
-    /** The output types. */
+    /**
+     * The output types.
+     */
     protected Class[] outputTypes;
-    
-    /** The reader spi names. */
+
+    /**
+     * The reader SPI names.
+     */
     protected String[] readerSpiNames;
 
     /**
@@ -51,50 +62,62 @@
     /**
      * Instantiates a new ImageWriterSpi with the specified parameters.
      * 
-     * @param vendorName the vendor name.
-     * @param version the version.
-     * @param names the format names.
-     * @param suffixes the array of strings representing the file suffixes. 
-     * @param MIMETypes the an array of strings representing MIME types.
-     * @param pluginClassName the plugin class name.
-     * @param outputTypes the output types.
-     * @param readerSpiNames the array of strings with class names of all 
-     * associated ImageReaders.
-     * @param supportsStandardStreamMetadataFormat the value indicating
-     * if stream metadata can be described by standard metadata format.
-     * @param nativeStreamMetadataFormatName the native stream metadata 
-     * format name, returned by getNativeStreamMetadataFormatName.
-     * @param nativeStreamMetadataFormatClassName the native stream 
-     * metadata format class name, returned by getNativeStreamMetadataFormat.
-     * @param extraStreamMetadataFormatNames the extra stream metadata 
-     * format names, returned by getExtraStreamMetadataFormatNames.
-     * @param extraStreamMetadataFormatClassNames the extra stream metadata 
-     * format class names, returned by getStreamMetadataFormat.
-     * @param supportsStandardImageMetadataFormat the value indicating
-     * if image metadata can be described by standard metadata format.
-     * @param nativeImageMetadataFormatName the native image metadata 
-     * format name, returned by getNativeImageMetadataFormatName.
-     * @param nativeImageMetadataFormatClassName the native image
-     * metadata format class name, returned by getNativeImageMetadataFormat.
-     * @param extraImageMetadataFormatNames the extra image metadata 
-     * format names, returned by getExtraImageMetadataFormatNames.
-     * @param extraImageMetadataFormatClassNames the extra image metadata 
-     * format class names, returned by getImageMetadataFormat.
+     * @param vendorName
+     *            the vendor name.
+     * @param version
+     *            the version.
+     * @param names
+     *            the format names.
+     * @param suffixes
+     *            the array of strings representing the file suffixes.
+     * @param MIMETypes
+     *            the an array of strings representing MIME types.
+     * @param pluginClassName
+     *            the plug-in class name.
+     * @param outputTypes
+     *            the output types.
+     * @param readerSpiNames
+     *            the array of strings with class names of all associated
+     *            ImageReaders.
+     * @param supportsStandardStreamMetadataFormat
+     *            the value indicating if stream metadata can be described by
+     *            standard metadata format.
+     * @param nativeStreamMetadataFormatName
+     *            the native stream metadata format name, returned by
+     *            getNativeStreamMetadataFormatName.
+     * @param nativeStreamMetadataFormatClassName
+     *            the native stream metadata format class name, returned by
+     *            getNativeStreamMetadataFormat.
+     * @param extraStreamMetadataFormatNames
+     *            the extra stream metadata format names, returned by
+     *            getExtraStreamMetadataFormatNames.
+     * @param extraStreamMetadataFormatClassNames
+     *            the extra stream metadata format class names, returned by
+     *            getStreamMetadataFormat.
+     * @param supportsStandardImageMetadataFormat
+     *            the value indicating if image metadata can be described by
+     *            standard metadata format.
+     * @param nativeImageMetadataFormatName
+     *            the native image metadata format name, returned by
+     *            getNativeImageMetadataFormatName.
+     * @param nativeImageMetadataFormatClassName
+     *            the native image metadata format class name, returned by
+     *            getNativeImageMetadataFormat.
+     * @param extraImageMetadataFormatNames
+     *            the extra image metadata format names, returned by
+     *            getExtraImageMetadataFormatNames.
+     * @param extraImageMetadataFormatClassNames
+     *            the extra image metadata format class names, returned by
+     *            getImageMetadataFormat.
      */
-    public ImageWriterSpi(String vendorName, String version, String[] names,
-                             String[] suffixes, String[] MIMETypes,
-                             String pluginClassName,
-                             Class[] outputTypes, String[] readerSpiNames,
-                             boolean supportsStandardStreamMetadataFormat,
-                             String nativeStreamMetadataFormatName,
-                             String nativeStreamMetadataFormatClassName,
-                             String[] extraStreamMetadataFormatNames,
-                             String[] extraStreamMetadataFormatClassNames,
-                             boolean supportsStandardImageMetadataFormat,
-                             String nativeImageMetadataFormatName,
-                             String nativeImageMetadataFormatClassName,
-                             String[] extraImageMetadataFormatNames,
-                             String[] extraImageMetadataFormatClassNames) {
+    public ImageWriterSpi(String vendorName, String version, String[] names, String[] suffixes,
+            String[] MIMETypes, String pluginClassName, Class[] outputTypes,
+            String[] readerSpiNames, boolean supportsStandardStreamMetadataFormat,
+            String nativeStreamMetadataFormatName, String nativeStreamMetadataFormatClassName,
+            String[] extraStreamMetadataFormatNames, String[] extraStreamMetadataFormatClassNames,
+            boolean supportsStandardImageMetadataFormat, String nativeImageMetadataFormatName,
+            String nativeImageMetadataFormatClassName, String[] extraImageMetadataFormatNames,
+            String[] extraImageMetadataFormatClassNames) {
         super(vendorName, version, names, suffixes, MIMETypes, pluginClassName,
                 supportsStandardStreamMetadataFormat, nativeStreamMetadataFormatName,
                 nativeStreamMetadataFormatClassName, extraStreamMetadataFormatNames,
@@ -111,8 +134,8 @@
     }
 
     /**
-     * Returns true if the format of the writer's output is lossless. 
-     * The default implementation returns true.
+     * Returns true if the format of the writer's output is lossless. The
+     * default implementation returns true.
      * 
      * @return true, if a format is lossless, false otherwise.
      */
@@ -121,8 +144,8 @@
     }
 
     /**
-     * Gets an array of Class objects whose types 
-     * can be used as output for this writer.
+     * Gets an array of Class objects whose types can be used as output for this
+     * writer.
      * 
      * @return the output types.
      */
@@ -131,77 +154,72 @@
     }
 
     /**
-     * Checks whether or not the ImageWriter implementation associated 
-     * with this service provider can encode an image with 
-     * the specified type.
+     * Checks whether or not the ImageWriter implementation associated with this
+     * service provider can encode an image with the specified type.
      * 
-     * @param type the ImageTypeSpecifier.
-     * 
-     * @return true, if an image with the specified type can be
-     * encoded, false otherwise. 
+     * @param type
+     *            the ImageTypeSpecifier.
+     * @return true, if an image with the specified type can be encoded, false
+     *         otherwise.
      */
     public abstract boolean canEncodeImage(ImageTypeSpecifier type);
 
     /**
-     * Checks whether or not the ImageWriter implementation associated 
-     * with this service provider can encode the specified RenderedImage.
+     * Checks whether or not the ImageWriter implementation associated with this
+     * service provider can encode the specified RenderedImage.
      * 
-     * @param im the RenderedImage.
-     * 
-     * @return true, if RenderedImage can be encoded, 
-     * false otherwise. 
+     * @param im
+     *            the RenderedImage.
+     * @return true, if RenderedImage can be encoded, false otherwise.
      */
     public boolean canEncodeImage(RenderedImage im) {
         return canEncodeImage(ImageTypeSpecifier.createFromRenderedImage(im));
     }
 
     /**
-     * Returns an instance of the ImageWriter implementation for
-     * this service provider.
+     * Returns an instance of the ImageWriter implementation for this service
+     * provider.
      * 
      * @return the ImageWriter.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public ImageWriter createWriterInstance() throws IOException {
         return createWriterInstance(null);
     }
 
     /**
-     * Returns an instance of the ImageWriter implementation for
-     * this service provider.
+     * Returns an instance of the ImageWriter implementation for this service
+     * provider.
      * 
-     * @param extension the a plugin specific extension object, or null.
-     * 
+     * @param extension
+     *            the a plug-in specific extension object, or null.
      * @return the ImageWriter.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public abstract ImageWriter createWriterInstance(Object extension) throws IOException;
 
     /**
-     * Checks whether or not the specified ImageWriter object 
-     * is an instance of the ImageWriter associated with this 
-     * service provider or not.
+     * Checks whether or not the specified ImageWriter object is an instance of
+     * the ImageWriter associated with this service provider or not.
      * 
-     * @param writer the ImageWriter.
-     * 
-     * @return true, if the specified ImageWriter object 
-     * is an instance of the ImageWriter associated with this 
-     * service provider, false otherwise.
+     * @param writer
+     *            the ImageWriter.
+     * @return true, if the specified ImageWriter object is an instance of the
+     *         ImageWriter associated with this service provider, false
+     *         otherwise.
      */
     public boolean isOwnWriter(ImageWriter writer) {
         throw new UnsupportedOperationException("Not supported yet");
     }
 
     /**
-     * Gets an array of strings with names of the ImageReaderSpi 
-     * classes that support the internal metadata representation 
-     * used by the ImageWriter of this service provider, or null if 
-     * there are no such ImageReaders.
+     * Gets an array of strings with names of the ImageReaderSpi classes that
+     * support the internal metadata representation used by the ImageWriter of
+     * this service provider, or null if there are no such ImageReaders.
      * 
-     * @return an array of strings with names of the ImageWriterSpi 
-     * classes.
+     * @return the array of strings with names of the ImageWriterSpi classes.
      */
     public String[] getImageReaderSpiNames() {
         return readerSpiNames;
diff --git a/awt/javax/imageio/spi/RegisterableService.java b/awt/javax/imageio/spi/RegisterableService.java
index b50754e..ae2f4d3 100644
--- a/awt/javax/imageio/spi/RegisterableService.java
+++ b/awt/javax/imageio/spi/RegisterableService.java
@@ -18,33 +18,37 @@
  * @author Rustem V. Rafikov
  * @version $Revision: 1.3 $
  */
+
 package javax.imageio.spi;
 
 /**
- * The RegisterableService interface provides service provider 
- * objects that can be registered by a ServiceRegistry, and 
- * notifications that registration and deregistration have been
- * performed.
+ * The RegisterableService interface provides service provider objects that can
+ * be registered by a ServiceRegistry, and notifications that registration and
+ * deregistration have been performed.
+ * 
+ * @since Android 1.0
  */
 public interface RegisterableService {
-    
+
     /**
-     * This method is called when the object which implements this
-     * interface is registered to the specified category of the 
-     * specified registry.
+     * This method is called when the object which implements this interface is
+     * registered to the specified category of the specified registry.
      * 
-     * @param registry the ServiceRegistry to be registered.
-     * @param category the class representing a category.
+     * @param registry
+     *            the ServiceRegistry to be registered.
+     * @param category
+     *            the class representing a category.
      */
     void onRegistration(ServiceRegistry registry, Class<?> category);
-    
+
     /**
-     * This method is called when the object which implements this
-     * interface is deregistered to the specified category of the 
-     * specified registry.
+     * This method is called when the object which implements this interface is
+     * deregistered to the specified category of the specified registry.
      * 
-     * @param registry the ServiceRegistry to be registered.
-     * @param category the class representing a category.
+     * @param registry
+     *            the ServiceRegistry to be registered.
+     * @param category
+     *            the class representing a category.
      */
     void onDeregistration(ServiceRegistry registry, Class<?> category);
 }
diff --git a/awt/javax/imageio/spi/ServiceRegistry.java b/awt/javax/imageio/spi/ServiceRegistry.java
index 1a18b02..79b02a3 100644
--- a/awt/javax/imageio/spi/ServiceRegistry.java
+++ b/awt/javax/imageio/spi/ServiceRegistry.java
@@ -18,48 +18,53 @@
  * @author Rustem V. Rafikov
  * @version $Revision: 1.3 $
  */
+
 package javax.imageio.spi;
 
 import java.util.*;
 import java.util.Map.Entry;
 
 /**
- * The ServiceRegistry class provides ability to register, 
- * deregister, look up and obtain service provider instances (SPIs).
- * A service means a set of interfaces and classes, and a service 
- * provider is an implementation of a service. Service providers can 
- * be associated with one or more categories. Each category is defined 
- * by a class or interface. Only a single instance of a each class is 
- * allowed to be registered as a category. 
+ * The ServiceRegistry class provides ability to register, deregister, look up
+ * and obtain service provider instances (SPIs). A service means a set of
+ * interfaces and classes, and a service provider is an implementation of a
+ * service. Service providers can be associated with one or more categories.
+ * Each category is defined by a class or interface. Only a single instance of a
+ * each class is allowed to be registered as a category.
+ * 
+ * @since Android 1.0
  */
 public class ServiceRegistry {
 
-    /** The categories. */
+    /**
+     * The categories.
+     */
     CategoriesMap categories = new CategoriesMap(this);
 
     /**
      * Instantiates a new ServiceRegistry with the specified categories.
      * 
-     * @param categoriesIterator an Iterator of Class objects 
-     * for defining of categories.
+     * @param categoriesIterator
+     *            an Iterator of Class objects for defining of categories.
      */
     public ServiceRegistry(Iterator<Class<?>> categoriesIterator) {
         if (null == categoriesIterator) {
             throw new IllegalArgumentException("categories iterator should not be NULL");
         }
-        while(categoriesIterator.hasNext()) {
-            Class<?> c =  categoriesIterator.next();
+        while (categoriesIterator.hasNext()) {
+            Class<?> c = categoriesIterator.next();
             categories.addCategory(c);
         }
     }
 
     /**
-     * Looks up and instantiates the available providers of this service using 
+     * Looks up and instantiates the available providers of this service using
      * the specified class loader.
      * 
-     * @param providerClass the Class object of the provider to be looked up.
-     * @param loader the class loader to be used.
-     * 
+     * @param providerClass
+     *            the Class object of the provider to be looked up.
+     * @param loader
+     *            the class loader to be used.
      * @return the iterator of providers objects for this service.
      */
     public static <T> Iterator<T> lookupProviders(Class<T> providerClass, ClassLoader loader) {
@@ -67,11 +72,11 @@
     }
 
     /**
-     * Looks up and instantiates the available providers of this service using 
+     * Looks up and instantiates the available providers of this service using
      * the context class loader.
      * 
-     * @param providerClass the Class object of the provider to be looked up.
-     * 
+     * @param providerClass
+     *            the Class object of the provider to be looked up.
      * @return the iterator of providers objects for this service.
      */
     public static <T> Iterator<T> lookupProviders(Class<T> providerClass) {
@@ -79,14 +84,15 @@
     }
 
     /**
-     * Registers the specified service provider object in the
-     * specified categories.
+     * Registers the specified service provider object in the specified
+     * categories.
      * 
-     * @param provider the specified provider to be registered.
-     * @param category the category.
-     * 
-     * @return true if no provider of the same class is registered 
-     * in this category, false otherwise.
+     * @param provider
+     *            the specified provider to be registered.
+     * @param category
+     *            the category.
+     * @return true, if no provider of the same class is registered in this
+     *         category, false otherwise.
      */
     public <T> boolean registerServiceProvider(T provider, Class<T> category) {
         return categories.addProvider(provider, category);
@@ -95,7 +101,8 @@
     /**
      * Registers a list of service providers.
      * 
-     * @param providers the list of service providers.
+     * @param providers
+     *            the list of service providers.
      */
     public void registerServiceProviders(Iterator<?> providers) {
         for (Iterator<?> iterator = providers; iterator.hasNext();) {
@@ -104,67 +111,70 @@
     }
 
     /**
-     * Registers the specified service provider object in all
-     * categories.
+     * Registers the specified service provider object in all categories.
      * 
-     * @param provider the service provider.
+     * @param provider
+     *            the service provider.
      */
     public void registerServiceProvider(Object provider) {
         categories.addProvider(provider, null);
     }
 
     /**
-     * Deregisters the specifies service provider from the
-     * specified category.
+     * Deregisters the specifies service provider from the specified category.
      * 
-     * @param provider the service provider to be deregistered.
-     * @param category the specified category.
-     * 
-     * @return true if the provider was already registered 
-     * in the specified category, false otherwise.
+     * @param provider
+     *            the service provider to be deregistered.
+     * @param category
+     *            the specified category.
+     * @return true, if the provider was already registered in the specified
+     *         category, false otherwise.
      */
     public <T> boolean deregisterServiceProvider(T provider, Class<T> category) {
         throw new UnsupportedOperationException("Not supported yet");
     }
 
     /**
-     * Deregisters the specified service provider from all
-     * categories.
+     * Deregisters the specified service provider from all categories.
      * 
-     * @param provider the specified service provider.
+     * @param provider
+     *            the specified service provider.
      */
     public void deregisterServiceProvider(Object provider) {
         throw new UnsupportedOperationException("Not supported yet");
     }
 
     /**
-     * Gets an Iterator of registered service providers
-     * in the specified category which satisfy the specified Filter. 
-     * The useOrdering parameter indicates whether the iterator will 
-     * return all of the server provider objects in a set order. 
+     * Gets an Iterator of registered service providers in the specified
+     * category which satisfy the specified Filter. The useOrdering parameter
+     * indicates whether the iterator will return all of the server provider
+     * objects in a set order.
      * 
-     * @param category the specified category.
-     * @param filter the specified filter.
-     * @param useOrdering the flag indicating that providers are ordered
-     * in the returned Iterator.
-     * 
+     * @param category
+     *            the specified category.
+     * @param filter
+     *            the specified filter.
+     * @param useOrdering
+     *            the flag indicating that providers are ordered in the returned
+     *            Iterator.
      * @return the iterator of registered service providers.
      */
     @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));
+        return new FilteredIterator<T>(filter, (Iterator<T>)categories.getProviders(category,
+                useOrdering));
     }
 
     /**
-     * Gets an Iterator of all registered service providers
-     * in the specified category. The useOrdering parameter
-     * indicates whether the iterator will return all of the server 
-     * provider objects in a set order. 
+     * Gets an Iterator of all registered service providers in the specified
+     * category. The useOrdering parameter indicates whether the iterator will
+     * return all of the server provider objects in a set order.
      * 
-     * @param category the specified category.
-     * @param useOrdering the flag indicating that providers are ordered
-     * in the returned Iterator.
-     * 
+     * @param category
+     *            the specified category.
+     * @param useOrdering
+     *            the flag indicating that providers are ordered in the returned
+     *            Iterator.
      * @return the Iterator of service providers.
      */
     @SuppressWarnings("unchecked")
@@ -173,11 +183,11 @@
     }
 
     /**
-     * Gets the registered service provider object that has the 
-     * specified class type.
+     * Gets the registered service provider object that has the specified class
+     * type.
      * 
-     * @param providerClass the specified provider class.
-     * 
+     * @param providerClass
+     *            the specified provider class.
      * @return the service provider object.
      */
     public <T> T getServiceProviderByClass(Class<T> providerClass) {
@@ -185,28 +195,32 @@
     }
 
     /**
-     * Sets an ordering between two service provider objects 
-     * within the specified category. 
+     * Sets an ordering between two service provider objects within the
+     * specified category.
      * 
-     * @param category the specified category.
-     * @param firstProvider the first provider.
-     * @param secondProvider the second provider.
-     * 
-     * @return true if a previously unset order was set.
+     * @param category
+     *            the specified category.
+     * @param firstProvider
+     *            the first provider.
+     * @param secondProvider
+     *            the second provider.
+     * @return true, if a previously unset order was set.
      */
     public <T> boolean setOrdering(Class<T> category, T firstProvider, T secondProvider) {
         throw new UnsupportedOperationException("Not supported yet");
     }
 
     /**
-     * Unsets an ordering between two service provider objects 
-     * within the specified category.
+     * Unsets an ordering between two service provider objects within the
+     * specified category.
      * 
-     * @param category the specified category.
-     * @param firstProvider the first provider.
-     * @param secondProvider the second provider.
-     * 
-     * @return true if a previously unset order was removed.
+     * @param category
+     *            the specified category.
+     * @param firstProvider
+     *            the first provider.
+     * @param secondProvider
+     *            the second provider.
+     * @return true, if a previously unset order was removed.
      */
     public <T> boolean unsetOrdering(Class<T> category, T firstProvider, T secondProvider) {
         throw new UnsupportedOperationException("Not supported yet");
@@ -215,7 +229,8 @@
     /**
      * Deregisters all providers from the specified category.
      * 
-     * @param category the specified category.
+     * @param category
+     *            the specified category.
      */
     public void deregisterAll(Class<?> category) {
         throw new UnsupportedOperationException("Not supported yet");
@@ -229,32 +244,31 @@
     }
 
     /**
-     * Finalizes this object. 
+     * Finalizes this object.
      * 
-     * @throws Throwable throws if an error occurs during 
-     * finalization.
+     * @throws Throwable
+     *             if an error occurs during finalization.
      */
     @Override
     public void finalize() throws Throwable {
-        //TODO uncomment when deregisterAll is implemented
-        //deregisterAll();
+        // TODO uncomment when deregisterAll is implemented
+        // deregisterAll();
     }
 
     /**
      * Checks whether the specified provider has been already registered.
      * 
-     * @param provider the provider to be checked.
-     * 
+     * @param provider
+     *            the provider to be checked.
      * @return true, if the specified provider has been already registered,
-     * false otherwise.
+     *         false otherwise.
      */
     public boolean contains(Object provider) {
         throw new UnsupportedOperationException("Not supported yet");
     }
 
     /**
-     * Gets an iterator of Class objects representing the current 
-     * categories.
+     * Gets an iterator of Class objects representing the current categories.
      * 
      * @return the Iterator of Class objects.
      */
@@ -263,20 +277,22 @@
     }
 
     /**
-     * The ServiceRegistry.Filter interface is used by 
-     * ServiceRegistry.getServiceProviders to filter providers according
-     * to the specified criterion. 
+     * The ServiceRegistry.Filter interface is used by
+     * ServiceRegistry.getServiceProviders to filter providers according to the
+     * specified criterion.
+     * 
+     * @since Android 1.0
      */
     public static interface Filter {
-        
+
         /**
-         * Returns true if the specified provider satisfies the 
-         * criterion of this Filter.
+         * Returns true if the specified provider satisfies the criterion of
+         * this Filter.
          * 
-         * @param provider the provider.
-         * 
-         * @return true if the specified provider satisfies the 
-         * criterion of this Filter, false otherwise.
+         * @param provider
+         *            the provider.
+         * @return true, if the specified provider satisfies the criterion of
+         *         this Filter, false otherwise.
          */
         boolean filter(Object provider);
     }
@@ -285,30 +301,36 @@
      * The Class CategoriesMap.
      */
     private static class CategoriesMap {
-        
-        /** The categories. */
+
+        /**
+         * The categories.
+         */
         Map<Class<?>, ProvidersMap> categories = new HashMap<Class<?>, ProvidersMap>();
 
-        /** The registry. */
+        /**
+         * The registry.
+         */
         ServiceRegistry registry;
 
         /**
          * Instantiates a new categories map.
          * 
-         * @param registry the registry
+         * @param registry
+         *            the registry.
          */
         public CategoriesMap(ServiceRegistry registry) {
             this.registry = registry;
         }
 
-        //-- TODO: useOrdering
+        // -- TODO: useOrdering
         /**
          * Gets the providers.
          * 
-         * @param category the category
-         * @param useOrdering the use ordering
-         * 
-         * @return the providers
+         * @param category
+         *            the category.
+         * @param useOrdering
+         *            the use ordering.
+         * @return the providers.
          */
         Iterator<?> getProviders(Class<?> category, boolean useOrdering) {
             ProvidersMap providers = categories.get(category);
@@ -321,7 +343,7 @@
         /**
          * List.
          * 
-         * @return the iterator< class<?>>
+         * @return the iterator< class<?>>.
          */
         Iterator<Class<?>> list() {
             return categories.keySet().iterator();
@@ -330,7 +352,8 @@
         /**
          * Adds the category.
          * 
-         * @param category the category
+         * @param category
+         *            the category.
          */
         void addCategory(Class<?> category) {
             categories.put(category, new ProvidersMap());
@@ -341,10 +364,11 @@
          * <code>null</code> then the provider will be added to all categories
          * which the provider is assignable from.
          * 
-         * @param provider provider to add
-         * @param category category to add provider to
-         * 
-         * @return if there were such provider in some category
+         * @param provider
+         *            provider to add.
+         * @param category
+         *            category to add provider to.
+         * @return true, if there were such provider in some category.
          */
         boolean addProvider(Object provider, Class<?> category) {
             if (provider == null) {
@@ -355,11 +379,11 @@
             if (category == null) {
                 rt = findAndAdd(provider);
             } else {
-                rt  = addToNamed(provider, category);
+                rt = addToNamed(provider, category);
             }
 
             if (provider instanceof RegisterableService) {
-                ((RegisterableService) provider).onRegistration(registry, category);
+                ((RegisterableService)provider).onRegistration(registry, category);
             }
 
             return rt;
@@ -368,10 +392,11 @@
         /**
          * Adds the to named.
          * 
-         * @param provider the provider
-         * @param category the category
-         * 
-         * @return true, if successful
+         * @param provider
+         *            the provider.
+         * @param category
+         *            the category.
+         * @return true, if successful.
          */
         private boolean addToNamed(Object provider, Class<?> category) {
             Object obj = categories.get(category);
@@ -380,15 +405,15 @@
                 throw new IllegalArgumentException("Unknown category: " + category);
             }
 
-            return ((ProvidersMap) obj).addProvider(provider);
+            return ((ProvidersMap)obj).addProvider(provider);
         }
 
         /**
          * Find and add.
          * 
-         * @param provider the provider
-         * 
-         * @return true, if successful
+         * @param provider
+         *            the provider.
+         * @return true, if successful.
          */
         private boolean findAndAdd(Object provider) {
             boolean rt = false;
@@ -405,17 +430,19 @@
      * The Class ProvidersMap.
      */
     private static class ProvidersMap {
-        //-- TODO: providers ordering support
+        // -- TODO: providers ordering support
 
-        /** The providers. */
+        /**
+         * The providers.
+         */
         Map<Class<?>, Object> providers = new HashMap<Class<?>, Object>();
 
         /**
          * Adds the provider.
          * 
-         * @param provider the provider
-         * 
-         * @return true, if successful
+         * @param provider
+         *            the provider.
+         * @return true, if successful.
          */
         boolean addProvider(Object provider) {
             return providers.put(provider.getClass(), provider) != null;
@@ -424,19 +451,19 @@
         /**
          * Gets the provider classes.
          * 
-         * @return the provider classes
+         * @return the provider classes.
          */
         Iterator<Class<?>> getProviderClasses() {
             return providers.keySet().iterator();
         }
 
-        //-- TODO ordering
+        // -- TODO ordering
         /**
          * Gets the providers.
          * 
-         * @param userOrdering the user ordering
-         * 
-         * @return the providers
+         * @param userOrdering
+         *            the user ordering.
+         * @return the providers.
          */
         Iterator<?> getProviders(boolean userOrdering) {
             return providers.values().iterator();
@@ -448,20 +475,28 @@
      */
     private static class FilteredIterator<E> implements Iterator<E> {
 
-        /** The filter. */
+        /**
+         * The filter.
+         */
         private Filter filter;
-        
-        /** The backend. */
+
+        /**
+         * The backend.
+         */
         private Iterator<E> backend;
-        
-        /** The next obj. */
+
+        /**
+         * The next obj.
+         */
         private E nextObj;
 
         /**
          * Instantiates a new filtered iterator.
          * 
-         * @param filter the filter
-         * @param backend the backend
+         * @param filter
+         *            the filter.
+         * @param backend
+         *            the backend.
          */
         public FilteredIterator(Filter filter, Iterator<E> backend) {
             this.filter = filter;
@@ -472,7 +507,7 @@
         /**
          * Next.
          * 
-         * @return the e
+         * @return the e.
          */
         public E next() {
             if (nextObj == null) {
@@ -486,7 +521,7 @@
         /**
          * Checks for next.
          * 
-         * @return true, if successful
+         * @return true, if successful.
          */
         public boolean hasNext() {
             return nextObj != null;
@@ -500,7 +535,8 @@
         }
 
         /**
-         * Sets nextObj to a next provider matching the criterion given by the filter.
+         * Sets nextObj to a next provider matching the criterion given by the
+         * filter.
          */
         private void findNext() {
             nextObj = null;
diff --git a/awt/javax/imageio/spi/package.html b/awt/javax/imageio/spi/package.html
new file mode 100644
index 0000000..18ceff4
--- /dev/null
+++ b/awt/javax/imageio/spi/package.html
@@ -0,0 +1,8 @@
+<html>
+  <body>
+    <p>
+    This package provides several Service Provider Interface (SPI) classes for readers, writers, transcoders and streams to handle images.
+    </p>
+  @since Android 1.0
+  </body>
+</html>
diff --git a/awt/javax/imageio/stream/FileCacheImageInputStream.java b/awt/javax/imageio/stream/FileCacheImageInputStream.java
index 47bc189..710ac66 100644
--- a/awt/javax/imageio/stream/FileCacheImageInputStream.java
+++ b/awt/javax/imageio/stream/FileCacheImageInputStream.java
@@ -15,38 +15,43 @@
  *  limitations under the License.
  */
 
-
 package javax.imageio.stream;
 
 import java.io.*;
 
 /**
- * The FileCacheImageInputStream class is an implementation of
- * ImageInputStream which reads from its InputStream
- * and uses a temporary file as a cache. 
+ * The FileCacheImageInputStream class is an implementation of ImageInputStream
+ * which reads from its InputStream and uses a temporary file as a cache.
+ * 
+ * @since Android 1.0
  */
 public class FileCacheImageInputStream extends ImageInputStreamImpl {
-    
-    /** The is. */
-    private InputStream is;
-    
-    /** The file. */
-    private File file;
-    
-    /** The raf. */
-    private RandomAccessFile raf;
-
 
     /**
-     * Instantiates a new FileCacheImageInputStream from
-     * the specified InputStream and using the specified 
-     * File as its cache directory.
+     * The is.
+     */
+    private InputStream is;
+
+    /**
+     * The file.
+     */
+    private File file;
+
+    /**
+     * The raf.
+     */
+    private RandomAccessFile raf;
+
+    /**
+     * Instantiates a new FileCacheImageInputStream from the specified
+     * InputStream and using the specified File as its cache directory.
      * 
-     * @param stream the InputStream for reading.
-     * @param cacheDir the cache directory where the chache file
-     * will be created.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param stream
+     *            the InputStream for reading.
+     * @param cacheDir
+     *            the cache directory where the cache file will be created.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public FileCacheImageInputStream(InputStream stream, File cacheDir) throws IOException {
         if (stream == null) {
@@ -55,7 +60,8 @@
         is = stream;
 
         if (cacheDir == null || cacheDir.isDirectory()) {
-            file = File.createTempFile(FileCacheImageOutputStream.IIO_TEMP_FILE_PREFIX, null, cacheDir);
+            file = File.createTempFile(FileCacheImageOutputStream.IIO_TEMP_FILE_PREFIX, null,
+                    cacheDir);
             file.deleteOnExit();
         } else {
             throw new IllegalArgumentException("Not a directory!");
diff --git a/awt/javax/imageio/stream/FileCacheImageOutputStream.java b/awt/javax/imageio/stream/FileCacheImageOutputStream.java
index ae48585..135afab 100644
--- a/awt/javax/imageio/stream/FileCacheImageOutputStream.java
+++ b/awt/javax/imageio/stream/FileCacheImageOutputStream.java
@@ -15,7 +15,6 @@
  *  limitations under the License.
  */
 
-
 package javax.imageio.stream;
 
 import java.io.IOException;
@@ -24,35 +23,48 @@
 import java.io.RandomAccessFile;
 
 /**
- * The FileCacheImageOutputStream class is an implementation of 
- * ImageOutputStream that writes to its OutputStream
- * using a temporary file as a cache. 
+ * The FileCacheImageOutputStream class is an implementation of
+ * ImageOutputStream that writes to its OutputStream using a temporary file as a
+ * cache.
+ * 
+ * @since Android 1.0
  */
 public class FileCacheImageOutputStream extends ImageOutputStreamImpl {
-    
-    /** The Constant IIO_TEMP_FILE_PREFIX. */
+
+    /**
+     * The Constant IIO_TEMP_FILE_PREFIX.
+     */
     static final String IIO_TEMP_FILE_PREFIX = "iioCache";
-    
-    /** The Constant MAX_BUFFER_LEN. */
+
+    /**
+     * The Constant MAX_BUFFER_LEN.
+     */
     static final int MAX_BUFFER_LEN = 1048575; // 1 MB - is it not too much?
 
-    /** The os. */
+    /**
+     * The os.
+     */
     private OutputStream os;
-    
-    /** The file. */
+
+    /**
+     * The file.
+     */
     private File file;
-    
-    /** The raf. */
+
+    /**
+     * The raf.
+     */
     private RandomAccessFile raf;
 
     /**
      * Instantiates a FileCacheImageOutputStream.
      * 
-     * @param stream the OutputStream for writing.
-     * @param cacheDir the cache directory where the chache file
-     * will be created.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param stream
+     *            the OutputStream for writing.
+     * @param cacheDir
+     *            the cache directory where the cache file will be created.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public FileCacheImageOutputStream(OutputStream stream, File cacheDir) throws IOException {
         if (stream == null) {
@@ -96,7 +108,7 @@
     @Override
     public void write(int b) throws IOException {
         flushBits(); // See the flushBits method description
-        
+
         raf.write(b);
         streamPos++;
     }
@@ -148,7 +160,7 @@
         } else {
             byte buffer[] = new byte[MAX_BUFFER_LEN];
             while (bytesToRead > 0) {
-                int count = (int) Math.min(MAX_BUFFER_LEN, bytesToRead);
+                int count = (int)Math.min(MAX_BUFFER_LEN, bytesToRead);
                 raf.readFully(buffer, 0, count);
                 os.write(buffer, 0, count);
                 bytesToRead -= count;
@@ -169,7 +181,7 @@
         }
 
         raf.seek(pos);
-        streamPos = raf.getFilePointer();        
+        streamPos = raf.getFilePointer();
         bitOffset = 0;
     }
 
@@ -177,7 +189,7 @@
     public long length() {
         try {
             return raf.length();
-        } catch(IOException e) {
+        } catch (IOException e) {
             return -1L;
         }
     }
diff --git a/awt/javax/imageio/stream/FileImageInputStream.java b/awt/javax/imageio/stream/FileImageInputStream.java
index 6680ae0..b9b6002 100644
--- a/awt/javax/imageio/stream/FileImageInputStream.java
+++ b/awt/javax/imageio/stream/FileImageInputStream.java
@@ -15,7 +15,6 @@
  *  limitations under the License.
  */
 
-
 package javax.imageio.stream;
 
 import java.io.IOException;
@@ -24,24 +23,31 @@
 import java.io.FileNotFoundException;
 
 /**
- * The FileImageInputStream class implements ImageInputStream 
- * and obtains its input data from a File or RandomAccessFile. 
+ * The FileImageInputStream class implements ImageInputStream and obtains its
+ * input data from a File or RandomAccessFile.
+ * 
+ * @since Android 1.0
  */
 public class FileImageInputStream extends ImageInputStreamImpl {
-    
-    /** The raf. */
+
+    /**
+     * The raf.
+     */
     RandomAccessFile raf;
 
     /**
      * Instantiates a new FileImageInputStream from the specified File.
      * 
-     * @param f the File of input data.
-     * 
-     * @throws FileNotFoundException if the specified file 
-     * doesn't exist.
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param f
+     *            the File of input data.
+     * @throws FileNotFoundException
+     *             if the specified file doesn't exist.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
-    @SuppressWarnings({"DuplicateThrows"})
+    @SuppressWarnings( {
+        "DuplicateThrows"
+    })
     public FileImageInputStream(File f) throws FileNotFoundException, IOException {
         if (f == null) {
             throw new IllegalArgumentException("f == null!");
@@ -51,10 +57,11 @@
     }
 
     /**
-     * Instantiates a new FileImageInputStream from the specified 
+     * Instantiates a new FileImageInputStream from the specified
      * RandomAccessFile.
      * 
-     * @param raf the RandomAccessFile of input data.
+     * @param raf
+     *            the RandomAccessFile of input data.
      */
     public FileImageInputStream(RandomAccessFile raf) {
         if (raf == null) {
@@ -91,7 +98,7 @@
     public long length() {
         try {
             return raf.length();
-        } catch(IOException e) {
+        } catch (IOException e) {
             return -1L;
         }
     }
diff --git a/awt/javax/imageio/stream/FileImageOutputStream.java b/awt/javax/imageio/stream/FileImageOutputStream.java
index eaafe14..2730ba6 100644
--- a/awt/javax/imageio/stream/FileImageOutputStream.java
+++ b/awt/javax/imageio/stream/FileImageOutputStream.java
@@ -18,39 +18,44 @@
  * @author Rustem V. Rafikov
  * @version $Revision: 1.3 $
  */
+
 package javax.imageio.stream;
 
 import java.io.*;
 
 /**
- * The FileImageOutputStream class implements ImageOutputStream 
- * and writes the output data to a File or RandomAccessFile. 
+ * The FileImageOutputStream class implements ImageOutputStream and writes the
+ * output data to a File or RandomAccessFile.
+ * 
+ * @since Android 1.0
  */
 public class FileImageOutputStream extends ImageOutputStreamImpl {
 
-    /** The file. */
+    /**
+     * The file.
+     */
     RandomAccessFile file;
 
     /**
-     * Instantiates a new FileImageOutputStream with the specified
-     * File.
+     * Instantiates a new FileImageOutputStream with the specified File.
      * 
-     * @param f the output File.
-     * 
-     * @throws FileNotFoundException if the file not found.
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param f
+     *            the output File.
+     * @throws FileNotFoundException
+     *             if the file not found.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     public FileImageOutputStream(File f) throws FileNotFoundException, IOException {
-        this(f != null
-                ? new RandomAccessFile(f, "rw")
-                : null);
+        this(f != null ? new RandomAccessFile(f, "rw") : null);
     }
 
     /**
      * Instantiates a new FileImageOutputStream with the specified
      * RandomAccessFile.
      * 
-     * @param raf the output RandomAccessFile.
+     * @param raf
+     *            the output RandomAccessFile.
      */
     public FileImageOutputStream(RandomAccessFile raf) {
         if (raf == null) {
@@ -102,14 +107,14 @@
         try {
             checkClosed();
             return file.length();
-        } catch(IOException e) {
+        } catch (IOException e) {
             return super.length(); // -1L
         }
     }
 
     @Override
     public void seek(long pos) throws IOException {
-        //-- checkClosed() is performed in super.seek()
+        // -- checkClosed() is performed in super.seek()
         super.seek(pos);
         file.seek(pos);
         streamPos = file.getFilePointer();
diff --git a/awt/javax/imageio/stream/IIOByteBuffer.java b/awt/javax/imageio/stream/IIOByteBuffer.java
index 961a7b3..867d808 100644
--- a/awt/javax/imageio/stream/IIOByteBuffer.java
+++ b/awt/javax/imageio/stream/IIOByteBuffer.java
@@ -18,35 +18,46 @@
  * @author Sergey I. Salishev
  * @version $Revision: 1.2 $
  */
+
 package javax.imageio.stream;
 
-/** 
-* @author Sergey I. Salishev
-* @version $Revision: 1.2 $
-*/
+// 
+// @author Sergey I. Salishev
+// @version $Revision: 1.2 $
+//
 
 /**
- * The IIOByteBuffer class represents a byte array with offset and 
- * length that is used by ImageInputStream for obtaining a sequence 
- * of bytes.
+ * The IIOByteBuffer class represents a byte array with offset and length that
+ * is used by ImageInputStream for obtaining a sequence of bytes.
+ * 
+ * @since Android 1.0
  */
 public class IIOByteBuffer {
-    
-    /** The data. */
+
+    /**
+     * The data.
+     */
     private byte[] data;
-    
-    /** The offset. */
+
+    /**
+     * The offset.
+     */
     private int offset;
-    
-    /** The length. */
+
+    /**
+     * The length.
+     */
     private int length;
 
     /**
      * Instantiates a new IIOByteBuffer.
      * 
-     * @param data the byte array.
-     * @param offset the offset in the array.
-     * @param length the length of array.
+     * @param data
+     *            the byte array.
+     * @param offset
+     *            the offset in the array.
+     * @param length
+     *            the length of array.
      */
     public IIOByteBuffer(byte[] data, int offset, int length) {
         this.data = data;
@@ -84,7 +95,8 @@
     /**
      * Sets the new data array to this IIOByteBuffer object.
      * 
-     * @param data the new data array.
+     * @param data
+     *            the new data array.
      */
     public void setData(byte[] data) {
         this.data = data;
@@ -93,7 +105,8 @@
     /**
      * Sets the length of data which will be used.
      * 
-     * @param length the new length.
+     * @param length
+     *            the new length.
      */
     public void setLength(int length) {
         this.length = length;
@@ -102,10 +115,10 @@
     /**
      * Sets the offset in the data array of this IIOByteBuffer.
      * 
-     * @param offset the new offset.
+     * @param offset
+     *            the new offset.
      */
     public void setOffset(int offset) {
         this.offset = offset;
     }
 }
-
diff --git a/awt/javax/imageio/stream/ImageInputStream.java b/awt/javax/imageio/stream/ImageInputStream.java
index 771e9ff..3dec5d2 100644
--- a/awt/javax/imageio/stream/ImageInputStream.java
+++ b/awt/javax/imageio/stream/ImageInputStream.java
@@ -18,6 +18,7 @@
  * @author Rustem V. Rafikov
  * @version $Revision: 1.2 $
  */
+
 package javax.imageio.stream;
 
 import java.io.DataInput;
@@ -25,21 +26,24 @@
 import java.nio.ByteOrder;
 
 /**
- * The ImageInputStream represents input stream interface that is 
- * used by ImageReaders.
+ * The ImageInputStream represents input stream interface that is used by
+ * ImageReaders.
+ * 
+ * @since Android 1.0
  */
 public interface ImageInputStream extends DataInput {
 
     /**
-     * Sets the specified byte order for reading of data values 
-     * from this stream. 
+     * Sets the specified byte order for reading of data values from this
+     * stream.
      * 
-     * @param byteOrder the byte order.
+     * @param byteOrder
+     *            the byte order.
      */
     void setByteOrder(ByteOrder byteOrder);
 
     /**
-     * Gets the byte order. 
+     * Gets the byte order.
      * 
      * @return the byte order.
      */
@@ -48,158 +52,151 @@
     /**
      * Reads a byte from the stream.
      * 
-     * @return the byte of the stream, or -1 for EOF indicating. 
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @return the byte of the stream, or -1 for EOF indicating.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     int read() throws IOException;
 
     /**
-     * Reads number of bytes which is equal to the specified array's length
-     * and stores a result to this array.
+     * Reads number of bytes which is equal to the specified array's length and
+     * stores a result to this array.
      * 
-     * @param b the byte array.
-     * 
+     * @param b
+     *            the byte array.
      * @return the number of read bytes, or -1 indicated EOF.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     int read(byte[] b) throws IOException;
 
     /**
-     * Reads the number of bytes specified by len parameter from 
-     * the stream and stores a result to the specified array
-     * with the specified offset.
+     * Reads the number of bytes specified by len parameter from the stream and
+     * stores a result to the specified array with the specified offset.
      * 
-     * @param b the byte array.
-     * @param off the offset.
-     * @param len the number of bytes to be read.
-     * 
+     * @param b
+     *            the byte array.
+     * @param off
+     *            the offset.
+     * @param len
+     *            the number of bytes to be read.
      * @return the number of read bytes, or -1 indicated EOF.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     int read(byte[] b, int off, int len) throws IOException;
 
     /**
-     * Reads the number of bytes specified by len parameter 
-     * from the stream, and modifies the specified IIOByteBuffer 
-     * with the byte array, offset, and length.
+     * Reads the number of bytes specified by len parameter from the stream, and
+     * modifies the specified IIOByteBuffer with the byte array, offset, and
+     * length.
      * 
-     * @param buf the IIOByteBuffer.
-     * @param len the number of bytes to be read.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param buf
+     *            the IIOByteBuffer.
+     * @param len
+     *            the number of bytes to be read.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     void readBytes(IIOByteBuffer buf, int len) throws IOException;
 
     /**
-     * Reads a byte from the stream and returns a boolean true value 
-     * if it is non zero, false if it is zero.
+     * Reads a byte from the stream and returns a boolean true value if it is
+     * non zero, false if it is zero.
      * 
-     * @return a boolean value for read byte. 
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @return the boolean value for read byte.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     boolean readBoolean() throws IOException;
 
     /**
-     * Reads a byte from the stream and returns its value
-     * as signed byte.
+     * Reads a byte from the stream and returns its value as signed byte.
      * 
-     * @return a signed byte value for read byte. 
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @return the signed byte value for read byte.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     byte readByte() throws IOException;
 
     /**
-     * Reads a byte from the stream and returns its value
-     * as int.
+     * Reads a byte from the stream and returns its value as an integer.
      * 
-     * @return a unsigned byte value for read byte as int. 
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @return the unsigned byte value for read byte as an integer.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     int readUnsignedByte() throws IOException;
 
     /**
-     * Reads 2 bytes from the stream, and returns the result 
-     * as a short.
+     * Reads 2 bytes from the stream, and returns the result as a short.
      * 
      * @return the signed short value from the stream.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     short readShort() throws IOException;
 
     /**
-     * Reads 2 bytes from the stream and returns its value
-     * as an unsigned short.
+     * Reads 2 bytes from the stream and returns its value as an unsigned short.
      * 
-     * @return a unsigned short value coded in an int. 
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @return a unsigned short value coded in an integer.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     int readUnsignedShort() throws IOException;
 
     /**
-     * Reads 2 bytes from the stream and returns their 
-     * unsigned char value.
+     * Reads 2 bytes from the stream and returns their unsigned char value.
      * 
      * @return the unsigned char value.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     char readChar() throws IOException;
 
     /**
-     * Reads 4 bytes from the stream, and returns the result 
-     * as an int.
+     * Reads 4 bytes from the stream, and returns the result as an integer.
      * 
-     * @return the signed int value from the stream.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @return the signed integer value from the stream.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     int readInt() throws IOException;
 
     /**
-     * Reads 4 bytes from the stream and returns its value
-     * as long.
+     * Reads 4 bytes from the stream and returns its value as long.
      * 
-     * @return a unsigned int value as long. 
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @return the unsigned integer value as long.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     long readUnsignedInt() throws IOException;
 
     /**
-     * Reads 8 bytes from the stream, and returns the result 
-     * as a long.
+     * Reads 8 bytes from the stream, and returns the result as a long.
      * 
      * @return the long value from the stream.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     long readLong() throws IOException;
 
     /**
-     * Reads 4 bytes from the stream, and returns the result 
-     * as a float.
+     * Reads 4 bytes from the stream, and returns the result as a float.
      * 
      * @return the float value from the stream.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     float readFloat() throws IOException;
 
     /**
-     * Reads 8 bytes from the stream, and returns the result 
-     * as a double.
+     * Reads 8 bytes from the stream, and returns the result as a double.
      * 
      * @return the double value from the stream.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     double readDouble() throws IOException;
 
@@ -207,120 +204,134 @@
      * Reads a line from the stream.
      * 
      * @return the string contained the line from the stream.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     String readLine() throws IOException;
 
     /**
-     * Reads bytes from the stream in a string that has been encoded 
-     * in a modified UTF-8 format.
+     * Reads bytes from the stream in a string that has been encoded in a
+     * modified UTF-8 format.
      * 
      * @return the string read from stream and modified UTF-8 format.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     String readUTF() throws IOException;
 
     /**
-     * Reads the specified number of bytes from the stream, 
-     * and stores the result into the specified array starting at 
-     * the specified index offset. 
+     * Reads the specified number of bytes from the stream, and stores the
+     * result into the specified array starting at the specified index offset.
      * 
-     * @param b the byte array.
-     * @param off the offset.
-     * @param len the number of bytes to be read.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param b
+     *            the byte array.
+     * @param off
+     *            the offset.
+     * @param len
+     *            the number of bytes to be read.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     void readFully(byte[] b, int off, int len) throws IOException;
 
     /**
-     * Reads number of bytes from the stream which is equal to 
-     * the specified array's length, and stores them into 
-     * this array.
+     * Reads number of bytes from the stream which is equal to the specified
+     * array's length, and stores them into this array.
      * 
-     * @param b the byte array.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param b
+     *            the byte array.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     void readFully(byte[] b) throws IOException;
 
     /**
-     * Reads the specified number of shorts from the stream, 
-     * and stores the result into the specified array starting at 
-     * the specified index offset. 
+     * Reads the specified number of shorts from the stream, and stores the
+     * result into the specified array starting at the specified index offset.
      * 
-     * @param s the short array.
-     * @param off the offset.
-     * @param len the number of shorts to be read.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param s
+     *            the short array.
+     * @param off
+     *            the offset.
+     * @param len
+     *            the number of shorts to be read.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     void readFully(short[] s, int off, int len) throws IOException;
 
     /**
-     * Reads the specified number of chars from the stream, 
-     * and stores the result into the specified array starting at 
-     * the specified index offset. 
+     * Reads the specified number of chars from the stream, and stores the
+     * result into the specified array starting at the specified index offset.
      * 
-     * @param c the char array.
-     * @param off the offset.
-     * @param len the number of chars to be read.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param c
+     *            the char array.
+     * @param off
+     *            the offset.
+     * @param len
+     *            the number of chars to be read.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     void readFully(char[] c, int off, int len) throws IOException;
 
     /**
-     * Reads the specified number of ints from the stream, 
-     * and stores the result into the specified array starting at 
-     * the specified index offset. 
+     * Reads the specified number of integer from the stream, and stores the
+     * result into the specified array starting at the specified index offset.
      * 
-     * @param i the int array.
-     * @param off the offset.
-     * @param len the number of ints to be read.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param i
+     *            the integer array.
+     * @param off
+     *            the offset.
+     * @param len
+     *            the number of integer to be read.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     void readFully(int[] i, int off, int len) throws IOException;
 
     /**
-     * Reads the specified number of longs from the stream, 
-     * and stores the result into the specified array starting at 
-     * the specified index offset. 
+     * Reads the specified number of longs from the stream, and stores the
+     * result into the specified array starting at the specified index offset.
      * 
-     * @param l the long array.
-     * @param off the offset.
-     * @param len the number of longs to be read.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param l
+     *            the long array.
+     * @param off
+     *            the offset.
+     * @param len
+     *            the number of longs to be read.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     void readFully(long[] l, int off, int len) throws IOException;
 
     /**
-     * Reads the specified number of floats from the stream, 
-     * and stores the result into the specified array starting at 
-     * the specified index offset. 
+     * Reads the specified number of floats from the stream, and stores the
+     * result into the specified array starting at the specified index offset.
      * 
-     * @param f the float array.
-     * @param off the offset.
-     * @param len the number of floats to be read.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param f
+     *            the float array.
+     * @param off
+     *            the offset.
+     * @param len
+     *            the number of floats to be read.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     void readFully(float[] f, int off, int len) throws IOException;
 
     /**
-     * Reads the specified number of doubles from the stream, 
-     * and stores the result into the specified array starting at 
-     * the specified index offset. 
+     * Reads the specified number of doubles from the stream, and stores the
+     * result into the specified array starting at the specified index offset.
      * 
-     * @param d the double array.
-     * @param off the offset.
-     * @param len the number of doubles to be read.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param d
+     *            the double array.
+     * @param off
+     *            the offset.
+     * @param len
+     *            the number of doubles to be read.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     void readFully(double[] d, int off, int len) throws IOException;
 
@@ -328,8 +339,8 @@
      * Gets the stream position.
      * 
      * @return the stream position.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     long getStreamPosition() throws IOException;
 
@@ -337,17 +348,18 @@
      * Gets the bit offset.
      * 
      * @return the bit offset.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     int getBitOffset() throws IOException;
 
     /**
-     * Sets the bit offset to an integer between 0 and 7. 
+     * Sets the bit offset to an integer between 0 and 7.
      * 
-     * @param bitOffset the bit offset.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param bitOffset
+     *            the bit offset.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     void setBitOffset(int bitOffset) throws IOException;
 
@@ -355,90 +367,94 @@
      * Reads a bit from the stream and returns the value 0 or 1.
      * 
      * @return the value of single bit: 0 or 1.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     int readBit() throws IOException;
 
     /**
      * Read the specified number of bits and returns their values as long.
      * 
-     * @param numBits the number of bits to be read.
-     * 
+     * @param numBits
+     *            the number of bits to be read.
      * @return the bit string as a long.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     long readBits(int numBits) throws IOException;
 
     /**
-     * Returns the length of the stream. 
-     *  
-     * @return the length of the stream, or -1 if unknown. 
+     * Returns the length of the stream.
      * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @return the length of the stream, or -1 if unknown.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     long length() throws IOException;
 
     /**
-     * Skipes the specified number of bytes by moving stream position. 
+     * Skips the specified number of bytes by moving stream position.
      * 
-     * @param n the number of bytes.
-     * 
+     * @param n
+     *            the number of bytes.
      * @return the actual skipped number of bytes.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     int skipBytes(int n) throws IOException;
 
     /**
-     * Skipes the specified number of bytes by moving stream position. 
+     * Skips the specified number of bytes by moving stream position.
      * 
-     * @param n the number of bytes.
-     * 
+     * @param n
+     *            the number of bytes.
      * @return the actual skipped number of bytes.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     long skipBytes(long n) throws IOException;
 
     /**
-     * Sets the current stream position to the specified location. 
+     * Sets the current stream position to the specified location.
      * 
-     * @param pos a file pointer position.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param pos
+     *            a file pointer position.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     void seek(long pos) throws IOException;
 
     /**
-     * Marks a position in the stream to be returned to by a subsequent 
-     * call to reset. 
+     * Marks a position in the stream to be returned to by a subsequent call to
+     * reset.
      */
     void mark();
 
     /**
      * Returns the file pointer to its previous position.
      * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     void reset() throws IOException;
 
     /**
-     * Flushes the initial position in this stream prior to the
-     * specified stream position.
+     * Flushes the initial position in this stream prior to the specified stream
+     * position.
      * 
-     * @param pos the position.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param pos
+     *            the position.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     void flushBefore(long pos) throws IOException;
 
     /**
-     * Flushes the initial position in this stream prior to the
-     * current stream position.
+     * Flushes the initial position in this stream prior to the current stream
+     * position.
      * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     void flush() throws IOException;
 
@@ -450,36 +466,37 @@
     long getFlushedPosition();
 
     /**
-     * Returns true if this ImageInputStream caches data in order 
-     * to allow seeking backwards.
+     * Returns true if this ImageInputStream caches data in order to allow
+     * seeking backwards.
      * 
-     * @return true if this ImageInputStream caches data in order 
-     * to allow seeking backwards, false otherwise.
+     * @return true, if this ImageInputStream caches data in order to allow
+     *         seeking backwards, false otherwise.
      */
     boolean isCached();
 
     /**
-     * Returns true if this ImageInputStream caches data in order 
-     * to allow seeking backwards, and keeps it in memory.
+     * Returns true if this ImageInputStream caches data in order to allow
+     * seeking backwards, and keeps it in memory.
      * 
-     * @return true if this ImageInputStream caches data in order 
-     * to allow seeking backwards, and keeps it in memory.
+     * @return true, if this ImageInputStream caches data in order to allow
+     *         seeking backwards, and keeps it in memory.
      */
     boolean isCachedMemory();
 
     /**
-     * Returns true if this ImageInputStream caches data in order 
-     * to allow seeking backwards, and keeps it in a temporary file.
+     * Returns true if this ImageInputStream caches data in order to allow
+     * seeking backwards, and keeps it in a temporary file.
      * 
-     * @return true if this ImageInputStream caches data in order 
-     * to allow seeking backwards, and keeps it in a temporary file.
+     * @return true, if this ImageInputStream caches data in order to allow
+     *         seeking backwards, and keeps it in a temporary file.
      */
     boolean isCachedFile();
 
     /**
      * Closes this stream.
      * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     void close() throws IOException;
 }
diff --git a/awt/javax/imageio/stream/ImageInputStreamImpl.java b/awt/javax/imageio/stream/ImageInputStreamImpl.java
index 83ac13a..d79da41 100644
--- a/awt/javax/imageio/stream/ImageInputStreamImpl.java
+++ b/awt/javax/imageio/stream/ImageInputStreamImpl.java
@@ -18,6 +18,7 @@
  * @author Rustem V. Rafikov
  * @version $Revision: 1.3 $
  */
+
 package javax.imageio.stream;
 
 import java.io.EOFException;
@@ -25,38 +26,54 @@
 import java.nio.ByteOrder;
 
 /**
- * The ImageInputStreamImpl abstract class implements
- * the ImageInputStream interface.
+ * The ImageInputStreamImpl abstract class implements the ImageInputStream
+ * interface.
+ * 
+ * @since Android 1.0
  */
 public abstract class ImageInputStreamImpl implements ImageInputStream {
 
-    /** The byte order. */
+    /**
+     * The byte order.
+     */
     protected ByteOrder byteOrder = ByteOrder.BIG_ENDIAN;
 
-    /** The stream position. */
+    /**
+     * The stream position.
+     */
     protected long streamPos = 0;
-    
-    /** The flushed position. */
+
+    /**
+     * The flushed position.
+     */
     protected long flushedPos = 0;
-    
-    /** The bit offset. */
+
+    /**
+     * The bit offset.
+     */
     protected int bitOffset = 0;
 
-    /** The closed. */
+    /**
+     * The closed.
+     */
     private boolean closed = false;
 
-    /** The position stack. */
+    /**
+     * The position stack.
+     */
     private final PositionStack posStack = new PositionStack();
 
     /**
      * Instantiates a new ImageInputStreamImpl.
      */
-    public ImageInputStreamImpl() {}
+    public ImageInputStreamImpl() {
+    }
 
     /**
      * Check if the stream is closed and if true, throws an IOException.
      * 
-     * @throws IOException Signals that the stream is closed.
+     * @throws IOException
+     *             if the stream is closed.
      */
     protected final void checkClosed() throws IOException {
         if (closed) {
@@ -106,7 +123,7 @@
         if (b < 0) {
             throw new EOFException("EOF reached");
         }
-        return (byte) b;
+        return (byte)b;
     }
 
     public int readUnsignedByte() throws IOException {
@@ -125,58 +142,57 @@
             throw new EOFException("EOF reached");
         }
 
-        return byteOrder == ByteOrder.BIG_ENDIAN ?
-                (short) ((b1 << 8) | (b2 & 0xff)) :
-                (short) ((b2 << 8) | (b1 & 0xff));
+        return byteOrder == ByteOrder.BIG_ENDIAN ? (short)((b1 << 8) | (b2 & 0xff))
+                : (short)((b2 << 8) | (b1 & 0xff));
     }
 
     public int readUnsignedShort() throws IOException {
-        //-- TODO implement
+        // -- TODO implement
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     public char readChar() throws IOException {
-        //-- TODO implement
+        // -- TODO implement
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     public int readInt() throws IOException {
-        //-- TODO implement
+        // -- TODO implement
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     public long readUnsignedInt() throws IOException {
-        //-- TODO implement
+        // -- TODO implement
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     public long readLong() throws IOException {
-        //-- TODO implement
+        // -- TODO implement
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     public float readFloat() throws IOException {
-        //-- TODO implement
+        // -- TODO implement
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     public double readDouble() throws IOException {
-        //-- TODO implement
+        // -- TODO implement
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     public String readLine() throws IOException {
-        //-- TODO implement
+        // -- TODO implement
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     public String readUTF() throws IOException {
-        //-- TODO implement
+        // -- TODO implement
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     public void readFully(byte[] b, int off, int len) throws IOException {
-        //-- TODO implement
+        // -- TODO implement
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
@@ -185,32 +201,32 @@
     }
 
     public void readFully(short[] s, int off, int len) throws IOException {
-        //-- TODO implement
+        // -- TODO implement
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     public void readFully(char[] c, int off, int len) throws IOException {
-        //-- TODO implement
+        // -- TODO implement
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     public void readFully(int[] i, int off, int len) throws IOException {
-        //-- TODO implement
+        // -- TODO implement
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     public void readFully(long[] l, int off, int len) throws IOException {
-        //-- TODO implement
+        // -- TODO implement
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     public void readFully(float[] f, int off, int len) throws IOException {
-        //-- TODO implement
+        // -- TODO implement
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     public void readFully(double[] d, int off, int len) throws IOException {
-        //-- TODO implement
+        // -- TODO implement
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
@@ -230,12 +246,12 @@
     }
 
     public int readBit() throws IOException {
-        //-- TODO implement
+        // -- TODO implement
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     public long readBits(int numBits) throws IOException {
-        //-- TODO implement
+        // -- TODO implement
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
@@ -244,12 +260,12 @@
     }
 
     public int skipBytes(int n) throws IOException {
-        //-- TODO implement
+        // -- TODO implement
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     public long skipBytes(long n) throws IOException {
-        //-- TODO implement
+        // -- TODO implement
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
@@ -272,7 +288,7 @@
     }
 
     public void reset() throws IOException {
-        //-- TODO bit pos
+        // -- TODO bit pos
         if (!posStack.isEmpty()) {
             long p = posStack.pop();
             if (p < flushedPos) {
@@ -290,7 +306,7 @@
             throw new IndexOutOfBoundsException("Trying to flush within already flushed portion");
         }
         flushedPos = pos;
-        //-- TODO implement
+        // -- TODO implement
     }
 
     public void flush() throws IOException {
@@ -302,15 +318,15 @@
     }
 
     public boolean isCached() {
-        return false; //def
+        return false; // def
     }
 
     public boolean isCachedMemory() {
-        return false; //def
+        return false; // def
     }
 
     public boolean isCachedFile() {
-        return false; //def
+        return false; // def
     }
 
     public void close() throws IOException {
@@ -322,7 +338,8 @@
     /**
      * Finalizes this object.
      * 
-     * @throws Throwable if an error occurs.
+     * @throws Throwable
+     *             if an error occurs.
      */
     @Override
     protected void finalize() throws Throwable {
@@ -339,25 +356,31 @@
      * The Class PositionStack.
      */
     private static class PositionStack {
-        
-        /** The Constant SIZE. */
+
+        /**
+         * The Constant SIZE.
+         */
         private static final int SIZE = 10;
 
-        /** The values. */
+        /**
+         * The values.
+         */
         private long[] values = new long[SIZE];
-        
-        /** The pos. */
-        private int pos = 0;
 
+        /**
+         * The pos.
+         */
+        private int pos = 0;
 
         /**
          * Push.
          * 
-         * @param v the v
+         * @param v
+         *            the v.
          */
         void push(long v) {
             if (pos >= values.length) {
-                ensure(pos+1);
+                ensure(pos + 1);
             }
             values[pos++] = v;
         }
@@ -365,7 +388,7 @@
         /**
          * Pop.
          * 
-         * @return the long
+         * @return the long.
          */
         long pop() {
             return values[--pos];
@@ -374,7 +397,7 @@
         /**
          * Checks if is empty.
          * 
-         * @return true, if is empty
+         * @return true, if is empty.
          */
         boolean isEmpty() {
             return pos == 0;
@@ -383,7 +406,8 @@
         /**
          * Ensure.
          * 
-         * @param size the size
+         * @param size
+         *            the size.
          */
         private void ensure(int size) {
             long[] arr = new long[Math.max(2 * values.length, size)];
diff --git a/awt/javax/imageio/stream/ImageOutputStream.java b/awt/javax/imageio/stream/ImageOutputStream.java
index e59b69d..28ec932 100644
--- a/awt/javax/imageio/stream/ImageOutputStream.java
+++ b/awt/javax/imageio/stream/ImageOutputStream.java
@@ -18,252 +18,289 @@
  * @author Rustem V. Rafikov
  * @version $Revision: 1.2 $
  */
+
 package javax.imageio.stream;
 
 import java.io.DataOutput;
 import java.io.IOException;
 
 /**
- * The ImageOutputStream represents output stream interface that is 
- * used by ImageWriters.
+ * The ImageOutputStream represents output stream interface that is used by
+ * ImageWriters.
+ * 
+ * @since Android 1.0
  */
 public interface ImageOutputStream extends DataOutput, ImageInputStream {
 
     /**
-     * Writes a single byte to the stream at the current position. 
+     * Writes a single byte to the stream at the current position.
      * 
-     * @param b the int value, of which the 8 lowest bits 
-     * will be written.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param b
+     *            the integer value, of which the 8 lowest bits will be written.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     void write(int b) throws IOException;
 
     /**
      * Writes the bytes array to the stream.
      * 
-     * @param b the byte array to be written.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param b
+     *            the byte array to be written.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     void write(byte[] b) throws IOException;
 
     /**
-     * Writes a number of bytes from the specified byte array
-     * beggining from the specified offset.
+     * Writes a number of bytes from the specified byte array beginning from the
+     * specified offset.
      * 
-     * @param b the byte array.
-     * @param off the offset.
-     * @param len the number of bytes to be written.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param b
+     *            the byte array.
+     * @param off
+     *            the offset.
+     * @param len
+     *            the number of bytes to be written.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     void write(byte[] b, int off, int len) throws IOException;
 
     /**
-     * Writes the specified boolean value to the stream, 1 if it is true,
-     * 0 if it is false.
+     * Writes the specified boolean value to the stream, 1 if it is true, 0 if
+     * it is false.
      * 
-     * @param b the boolean value to be written.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param b
+     *            the boolean value to be written.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     void writeBoolean(boolean b) throws IOException;
 
     /**
-     * Writes the 8 lowest bits of the specified int value to the stream. 
+     * Writes the 8 lowest bits of the specified integer value to the stream.
      * 
-     * @param b the specified int value.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param b
+     *            the specified integer value.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     void writeByte(int b) throws IOException;
 
     /**
-     * Writes a short value to the output stream. 
+     * Writes a short value to the output stream.
      * 
-     * @param v the short value to be written. 
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param v
+     *            the short value to be written.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     void writeShort(int v) throws IOException;
 
     /**
-     * Writes the 16 lowest bits of the specified int value to the stream.
+     * Writes the 16 lowest bits of the specified integer value to the stream.
      * 
-     * @param v the specified int value.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param v
+     *            the specified integer value.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     void writeChar(int v) throws IOException;
 
     /**
-     * Writes an integer value to the output stream. 
+     * Writes an integer value to the output stream.
      * 
-     * @param v the integer value to be written. 
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param v
+     *            the integer value to be written.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     void writeInt(int v) throws IOException;
 
     /**
      * Write long.
      * 
-     * @param v the long value
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param v
+     *            the long value.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     void writeLong(long v) throws IOException;
 
     /**
-     * Writes a float value to the output stream. 
+     * Writes a float value to the output stream.
      * 
-     * @param v the float which contains value to be written. 
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param v
+     *            the float which contains value to be written.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     void writeFloat(float v) throws IOException;
 
     /**
-     * Writes a double value to the output stream. 
+     * Writes a double value to the output stream.
      * 
-     * @param v the double which contains value to be written. 
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param v
+     *            the double which contains value to be written.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     void writeDouble(double v) throws IOException;
 
     /**
      * Writes the specified string to the stream.
      * 
-     * @param s the string to be written.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param s
+     *            the string to be written.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     void writeBytes(String s) throws IOException;
 
     /**
      * Writes the specified String to the output stream.
      * 
-     * @param s the String to be written.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param s
+     *            the String to be written.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     void writeChars(String s) throws IOException;
 
     /**
-     * Writes 2 bytes to the output stream in 
-     * the modified UTF-8  representation of every character of
-     * the specified string.      
+     * Writes 2 bytes to the output stream in the modified UTF-8 representation
+     * of every character of the specified string.
      * 
-     * @param s the specified string to be written.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param s
+     *            the specified string to be written.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     void writeUTF(String s) throws IOException;
 
     /**
-     * Flushes the initial position in this stream prior to the
-     * specified stream position.
+     * Flushes the initial position in this stream prior to the specified stream
+     * position.
      * 
-     * @param pos the position.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param pos
+     *            the position.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     void flushBefore(long pos) throws IOException;
 
-
     /**
-     * Writes a len number of short values from the specified array
-     * to the stream.
+     * Writes a len number of short values from the specified array to the
+     * stream.
      * 
-     * @param s the shorts array to be written.
-     * @param off the offset in the char array.
-     * @param len the length of chars to be written.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param s
+     *            the shorts array to be written.
+     * @param off
+     *            the offset in the char array.
+     * @param len
+     *            the length of chars to be written.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     void writeShorts(short[] s, int off, int len) throws IOException;
 
     /**
      * Writes a len number of chars to the stream.
      * 
-     * @param c the char array to be written.
-     * @param off the offset in the char array.
-     * @param len the length of chars to be written.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param c
+     *            the char array to be written.
+     * @param off
+     *            the offset in the char array.
+     * @param len
+     *            the length of chars to be written.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     void writeChars(char[] c, int off, int len) throws IOException;
 
     /**
-     * Writes a len number of int values from the specified array
-     * to the stream.
+     * Writes a len number of integer values from the specified array to the
+     * stream.
      * 
-     * @param i the int array to be written.
-     * @param off the offset in the char array.
-     * @param len the length of chars to be written.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param i
+     *            the integer array to be written.
+     * @param off
+     *            the offset in the char array.
+     * @param len
+     *            the length of chars to be written.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     void writeInts(int[] i, int off, int len) throws IOException;
 
     /**
-     * Writes a len number of long values from the specified array
-     * to the stream.
+     * Writes a len number of long values from the specified array to the
+     * stream.
      * 
-     * @param l the long array to be written.
-     * @param off the offset in the char array.
-     * @param len the length of chars to be written.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param l
+     *            the long array to be written.
+     * @param off
+     *            the offset in the char array.
+     * @param len
+     *            the length of chars to be written.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     void writeLongs(long[] l, int off, int len) throws IOException;
 
     /**
-     * Writes a len number of float values from the specified array
-     * to the stream.
+     * Writes a len number of float values from the specified array to the
+     * stream.
      * 
-     * @param f the float array to be written.
-     * @param off the offset in the char array.
-     * @param len the length of chars to be written.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param f
+     *            the float array to be written.
+     * @param off
+     *            the offset in the char array.
+     * @param len
+     *            the length of chars to be written.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     void writeFloats(float[] f, int off, int len) throws IOException;
 
     /**
-     * Writes a len number of double values from the specified array
-     * to the stream.
+     * Writes a len number of double values from the specified array to the
+     * stream.
      * 
-     * @param d the double array to be written.
-     * @param off the offset in the char array.
-     * @param len the length of chars to be written.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param d
+     *            the double array to be written.
+     * @param off
+     *            the offset in the char array.
+     * @param len
+     *            the length of chars to be written.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     void writeDoubles(double[] d, int off, int len) throws IOException;
 
     /**
      * Writes a single bit at the current position.
      * 
-     * @param bit the an int whose least significant bit is to be 
-     * written to the stream.
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param bit
+     *            the integer whose least significant bit is to be written to
+     *            the stream.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     void writeBit(int bit) throws IOException;
 
     /**
-     * Writes a sequence of bits beggining from the current position.
+     * Writes a sequence of bits beginning from the current position.
      * 
-     * @param bits a long value containing the bits to be written,
-     * starting with the bit in position numBits - 1 down to the 
-     * least significant bit.
-     * @param numBits the number of significant bit , 
-     * it can be between 0 and 64. 
-     * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @param bits
+     *            the long value containing the bits to be written, starting
+     *            with the bit in position numBits - 1 down to the least
+     *            significant bit.
+     * @param numBits
+     *            the number of significant bit, it can be between 0 and 64.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     void writeBits(long bits, int numBits) throws IOException;
 
diff --git a/awt/javax/imageio/stream/ImageOutputStreamImpl.java b/awt/javax/imageio/stream/ImageOutputStreamImpl.java
index c3d80fa..0fef78f 100644
--- a/awt/javax/imageio/stream/ImageOutputStreamImpl.java
+++ b/awt/javax/imageio/stream/ImageOutputStreamImpl.java
@@ -18,6 +18,7 @@
  * @author Rustem V. Rafikov
  * @version $Revision: 1.3 $
  */
+
 package javax.imageio.stream;
 
 import java.io.IOException;
@@ -29,16 +30,19 @@
  */
 
 /**
- * The ImageOutputStreamImpl abstract class implements
- * the ImageOutputStream interface.
+ * The ImageOutputStreamImpl abstract class implements the ImageOutputStream
+ * interface.
+ * 
+ * @since Android 1.0
  */
-public abstract class ImageOutputStreamImpl extends ImageInputStreamImpl
-        implements ImageOutputStream {
+public abstract class ImageOutputStreamImpl extends ImageInputStreamImpl implements
+        ImageOutputStream {
 
     /**
      * Instantiates a new ImageOutputStreamImpl.
      */
-    public ImageOutputStreamImpl() {}
+    public ImageOutputStreamImpl() {
+    }
 
     public abstract void write(int b) throws IOException;
 
@@ -62,7 +66,7 @@
         } else {
 
         }
-        //-- TODO implement
+        // -- TODO implement
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
@@ -76,7 +80,7 @@
         } else {
 
         }
-        //-- TODO implement
+        // -- TODO implement
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
@@ -86,7 +90,7 @@
         } else {
 
         }
-        //-- TODO implement
+        // -- TODO implement
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
@@ -108,62 +112,63 @@
     }
 
     public void writeUTF(String s) throws IOException {
-        //-- TODO implement
+        // -- TODO implement
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     public void writeShorts(short[] s, int off, int len) throws IOException {
-        //-- TODO implement
+        // -- TODO implement
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     public void writeChars(char[] c, int off, int len) throws IOException {
-        //-- TODO implement
+        // -- TODO implement
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     public void writeInts(int[] i, int off, int len) throws IOException {
-        //-- TODO implement
+        // -- TODO implement
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     public void writeLongs(long[] l, int off, int len) throws IOException {
-        //-- TODO implement
+        // -- TODO implement
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     public void writeFloats(float[] f, int off, int len) throws IOException {
-        //-- TODO implement
+        // -- TODO implement
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     public void writeDoubles(double[] d, int off, int len) throws IOException {
-        //-- TODO implement
+        // -- TODO implement
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     public void writeBit(int bit) throws IOException {
-        //-- TODO implement
+        // -- TODO implement
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     public void writeBits(long bits, int numBits) throws IOException {
-        //-- TODO implement
+        // -- TODO implement
         throw new UnsupportedOperationException("Not implemented yet");
     }
 
     /**
-     * Flushes the bits. This method should be called in the write
-     * methods by subclasses.
+     * Flushes the bits. This method should be called in the write methods by
+     * subclasses.
      * 
-     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws IOException
+     *             if an I/O exception has occurred.
      */
     protected final void flushBits() throws IOException {
         if (bitOffset == 0) {
             return;
         }
-        
-        //-- TODO implement
+
+        // -- TODO implement
         throw new UnsupportedOperationException("Not implemented yet");
     }
 }
diff --git a/awt/javax/imageio/stream/MemoryCacheImageInputStream.java b/awt/javax/imageio/stream/MemoryCacheImageInputStream.java
index a3d470b..d7fc791 100644
--- a/awt/javax/imageio/stream/MemoryCacheImageInputStream.java
+++ b/awt/javax/imageio/stream/MemoryCacheImageInputStream.java
@@ -15,7 +15,6 @@
  *  limitations under the License.
  */
 
-
 package javax.imageio.stream;
 
 import org.apache.harmony.x.imageio.stream.RandomAccessMemoryCache;
@@ -24,22 +23,29 @@
 import java.io.InputStream;
 
 /**
- * The MemoryCacheImageInputStream class implements ImageInputStream
- * using a memory buffer for caching the data.
+ * The MemoryCacheImageInputStream class implements ImageInputStream using a
+ * memory buffer for caching the data.
+ * 
+ * @since Android 1.0
  */
-public class MemoryCacheImageInputStream  extends ImageInputStreamImpl {
-    
-    /** The is. */
+public class MemoryCacheImageInputStream extends ImageInputStreamImpl {
+
+    /**
+     * The is.
+     */
     private InputStream is;
-    
-    /** The ramc. */
+
+    /**
+     * The ramc.
+     */
     private RandomAccessMemoryCache ramc = new RandomAccessMemoryCache();
 
     /**
-     * Instantiates a new MemoryCacheImageInputStream
-     * which reads from the specified InputStream.
+     * Instantiates a new MemoryCacheImageInputStream which reads from the
+     * specified InputStream.
      * 
-     * @param stream the InputStream to be read.
+     * @param stream
+     *            the InputStream to be read.
      */
     public MemoryCacheImageInputStream(InputStream stream) {
         if (stream == null) {
diff --git a/awt/javax/imageio/stream/MemoryCacheImageOutputStream.java b/awt/javax/imageio/stream/MemoryCacheImageOutputStream.java
index 96ded43..1df40a3 100644
--- a/awt/javax/imageio/stream/MemoryCacheImageOutputStream.java
+++ b/awt/javax/imageio/stream/MemoryCacheImageOutputStream.java
@@ -15,7 +15,6 @@
  *  limitations under the License.
  */
 
-
 package javax.imageio.stream;
 
 import org.apache.harmony.x.imageio.stream.RandomAccessMemoryCache;
@@ -23,24 +22,30 @@
 import java.io.OutputStream;
 import java.io.IOException;
 
-
 /**
- * The MemoryCacheImageOutputStream class implements ImageOutputStream
- * using a memory buffer for caching the data.
+ * The MemoryCacheImageOutputStream class implements ImageOutputStream using a
+ * memory buffer for caching the data.
+ * 
+ * @since Android 1.0
  */
 public class MemoryCacheImageOutputStream extends ImageOutputStreamImpl {
-    
-    /** The os. */
+
+    /**
+     * The os.
+     */
     OutputStream os;
-    
-    /** The ramc. */
+
+    /**
+     * The ramc.
+     */
     RandomAccessMemoryCache ramc = new RandomAccessMemoryCache();
 
     /**
-     * Instantiates a new MemoryCacheImageOutputStream
-     * which writes to the specified OutputStream.
+     * Instantiates a new MemoryCacheImageOutputStream which writes to the
+     * specified OutputStream.
      * 
-     * @param stream the OutputStream.
+     * @param stream
+     *            the OutputStream.
      */
     public MemoryCacheImageOutputStream(OutputStream stream) {
         if (stream == null) {
@@ -125,6 +130,6 @@
         ramc.getData(os, nBytes, flushedPosition);
         ramc.freeBefore(newFlushedPosition);
 
-        os.flush();        
+        os.flush();
     }
 }
diff --git a/awt/javax/imageio/stream/package.html b/awt/javax/imageio/stream/package.html
new file mode 100644
index 0000000..6cf53c3
--- /dev/null
+++ b/awt/javax/imageio/stream/package.html
@@ -0,0 +1,8 @@
+<html>
+  <body>
+    <p>
+      This package contains classes and interfaces for handling images with low-level I/O operations. 
+    </p>
+  @since Android 1.0
+  </body>
+</html>
