diff options
Diffstat (limited to 'awt/javax')
56 files changed, 4788 insertions, 3511 deletions
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 @@ public class IIOException extends IOException { /** * 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.awt.image.BufferedImage; 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 @@ public class IIOImage { } /** - * 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 @@ public class IIOImage { } /** - * 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 @@ public class IIOImage { /** * 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 @@ public class IIOImage { } /** - * 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 @@ public class IIOImage { * 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 @@ public class IIOImage { /** * 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 @@ public class IIOImage { /** * 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 @@ public class IIOImage { /** * 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 @@ public class IIOImage { /** * 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 @@ public abstract class IIOParam { 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 @@ public abstract class IIOParam { 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 @@ public abstract class IIOParam { 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 @@ public abstract class IIOParam { } /** - * 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 @@ public abstract class IIOParam { } /** - * 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 @@ public abstract class IIOParam { /** * 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 @@ public abstract class IIOParam { /** * 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 @@ public abstract class IIOParam { /** * Gets the type of the destination image as an ImageTypeSpecifier. . - * + * * @return the ImageTypeSpecifier. */ public ImageTypeSpecifier getDestinationType() { @@ -234,18 +262,19 @@ public abstract class IIOParam { } /** - * 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 @@ public abstract class IIOParam { * @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 @@ public abstract class IIOParam { } /** - * 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 @@ public abstract class IIOParam { } /** - * 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 @@ public abstract class IIOParam { } /** - * 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 @@ package javax.imageio; */ /** - * 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. - * - * @param param the IIOParam. + * Activates the controller. * - * @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.awt.image.RenderedImage; 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 @@ public final class ImageIO { /** * 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. - * - * @param input the input Object 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. * @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 @@ public final class ImageIO { } /** - * 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. + * 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. * @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 @@ public final class ImageIO { } /** - * 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 @@ public final class ImageIO { } /** - * 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 @@ public final class ImageIO { } /** - * Gets the Iterator of registered ImageReader which are able to - * decode an imput data specified by input Object. - * - * @param input the input Object with encoded data such as - * ImageInputStream object. + * Gets the Iterator of registered ImageReader which are able to decode an + * input data specified by input 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 @@ public final class ImageIO { } /** - * Gets the Iterator of registered ImageReader which are able to - * decode the specified format. - * - * @param formatName the format name such as "jpeg", or "gif". + * Gets the Iterator of registered ImageReader which are able to decode the + * specified format. * + * @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 @@ public final class ImageIO { } /** - * 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". + * 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". * @return the Iterator of registered ImageReaders. */ public static Iterator<ImageReader> getImageReadersBySuffix(String fileSuffix) { @@ -238,11 +241,11 @@ public final class ImageIO { } /** - * 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". + * 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". * @return the Iterator of registered ImageReaders. */ public static Iterator<ImageReader> getImageReadersByMIMEType(String MIMEType) { @@ -250,8 +253,8 @@ public final class ImageIO { } /** - * 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 @@ public final class ImageIO { } /** - * 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 @@ public final class ImageIO { } /** - * 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". + * 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". * @return the Iterator of registered ImageWriter. */ public static Iterator<ImageWriter> getImageWritersByFormatName(String formatName) { @@ -289,11 +292,11 @@ public final class ImageIO { } /** - * 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". + * 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". * @return the Iterator of registered ImageWriter. */ public static Iterator<ImageWriter> getImageWritersBySuffix(String fileSuffix) { @@ -306,11 +309,11 @@ public final class ImageIO { } /** - * 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". + * 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". * @return the Iterator of registered ImageWriter. */ public static Iterator<ImageWriter> getImageWritersByMIMEType(String MIMEType) { @@ -318,12 +321,12 @@ public final class ImageIO { } /** - * 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. + * 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. * @return the ImageWriter, or null. */ public static ImageWriter getImageWriter(ImageReader reader) { @@ -331,12 +334,12 @@ public final class ImageIO { } /** - * 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. + * 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. * @return the ImageReader. */ public static ImageReader getImageReader(ImageWriter writer) { @@ -344,17 +347,16 @@ public final class ImageIO { } /** - * 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. + * 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. * @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 @@ public final class ImageIO { } /** - * 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. + * 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. * @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. - * - * @param input the File to be read. + * 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. * @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 @@ public final class ImageIO { } /** - * 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 @@ public final class ImageIO { } /** - * 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 @@ public final class ImageIO { 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. - * - * @param stream the ImageInputStream. + * Reads image data from the specified ImageInputStream and decodes it using + * appropriate registered an ImageReader object. * - * @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 @@ public final class ImageIO { } 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. - * - * @param im the RenderedImage. - * @param formatName the format name. - * @param output the ImageOutputStream where Image to be written. + * 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. * @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 @@ public final class ImageIO { 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 @@ public final class ImageIO { } /** - * 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. + * 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. * @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 @@ public final class ImageIO { } /** - * 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. + * 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. * @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 @@ public final class ImageIO { 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 @@ public final class ImageIO { */ 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 @@ public final class ImageIO { @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 @@ public final class ImageIO { * 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 @@ public final class ImageIO { * 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 @@ public final class ImageIO { */ 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 @@ public final class ImageIO { /** * Next. * - * @return the image writer + * @return the image writer. */ public ImageWriter next() { try { @@ -713,7 +731,7 @@ public final class ImageIO { /** * Checks for next. * - * @return true, if successful + * @return true, if successful. */ public boolean hasNext() { return backend.hasNext(); @@ -723,7 +741,8 @@ public final class ImageIO { * 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 @@ public final class ImageIO { * 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 @@ public final class ImageIO { /** * Next. * - * @return the image reader + * @return the image reader. */ public ImageReader next() { try { @@ -761,7 +783,7 @@ public final class ImageIO { /** * Checks for next. * - * @return true, if successful + * @return true, if successful. */ public boolean hasNext() { return backend.hasNext(); @@ -771,7 +793,8 @@ public final class ImageIO { * 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 @@ import java.awt.image.BufferedImage; */ /** - * 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 @@ public class ImageReadParam extends IIOParam { } /** - * 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 @@ public class ImageReadParam extends IIOParam { } /** - * 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 @@ public class ImageReadParam extends IIOParam { } /** - * 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 @@ public class ImageReadParam extends IIOParam { } /** - * 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 @@ public class ImageReadParam extends IIOParam { /** * 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 @@ public class ImageReadParam extends IIOParam { /** * 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 @@ public class ImageReadParam extends IIOParam { } /** - * 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.image.RenderedImage; 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 @@ public abstract class ImageReader { * 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 @@ public abstract class ImageReader { } /** - * 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 @@ public abstract class ImageReader { /** * 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 @@ public abstract class ImageReader { * 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 @@ public abstract class ImageReader { * 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 @@ public abstract class ImageReader { /** * 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 @@ public abstract class ImageReader { /** * 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 @@ public abstract class ImageReader { /** * 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 @@ public abstract class ImageReader { /** * 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. - * - * @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. + * Checks if the storage format of the specified image places an impediment + * on random pixels access or not. * - * @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. - * - * @param imageIndex the image's index. + * Gets an ImageTypeSpecifier which indicates the type of the specified + * image. * + * @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. - * - * @param imageIndex the image index. + * 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. * @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 @@ public abstract class ImageReader { * 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 @@ public abstract class ImageReader { /** * 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. - * - * @param imageIndex the image index. - * @param param the ImageReadParam. + * Reads the specified image and returns it as a BufferedImage using the + * specified 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. - * - * @param imageIndex the image index. - * @param param the ImageReadParam. + * thumbnails, and metadata for this image, using the specified + * 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. - * - * @param params the Iterator of ImageReadParam objects. + * Returns an Iterator of IIOImages from the input source. * + * @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 @@ public abstract class ImageReader { /** * 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. - * - * @param imageIndex the image index. - * @param param the ImageReadParam. + * Reads a new Raster object which contains the raw pixel data from the + * image. * + * @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 @@ public abstract class ImageReader { /** * 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. - * - * @param imageIndex the image index. - * @param tileX the X index of tile. - * @param tileY the Y index of tile. + * 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. * @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. - * - * @param imageIndex the image index. - * @param tileX the X index of tile. - * @param tileY the Y index of tile. + * 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. * @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. - * - * @param imageIndex the image index. - * @param param the ImageReadParam. + * Reads the specified image using the specified ImageReadParam and returns + * it as a RenderedImage. * + * @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 @@ public abstract class ImageReader { /** * 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 @@ public abstract class ImageReader { /** * 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 @@ public abstract class ImageReader { /** * 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 @@ public abstract class ImageReader { /** * 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 @@ public abstract class ImageReader { /** * 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 @@ public abstract class ImageReader { /** * 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 @@ public abstract class ImageReader { } /** - * 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. - * - * @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) { + * 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. + */ + 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. - * - * @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) { + * 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. + */ + 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. - * - * @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. - */ - protected void processThumbnailPassStarted(BufferedImage theThumbnail, - int pass, - int minPass, - int maxPass, - int minX, - int minY, - int periodX, - int periodY, - int[] bands) { + * Processes the beginning of a thumbnail progressive pass by calling the + * thumbnailPassStarted method on all registered IIOReadUpdateListeners. + * + * @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) { 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. - * - * @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. - */ - protected void processThumbnailUpdate(BufferedImage theThumbnail, - int minX, - int minY, - int width, - int height, - int periodX, - int periodY, - int[] bands) { + * Processes the update of a set of samples in a thumbnail image by calling + * the thumbnailUpdate method on all registered IIOReadUpdateListeners. + * + * @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) { 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 @@ public abstract class ImageReader { } /** - * 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. + * 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. * @return the Rectangle of source region. */ protected static Rectangle getSourceRegion(ImageReadParam param, int srcWidth, int srcHeight) { @@ -1043,58 +1100,63 @@ public abstract class ImageReader { } /** - * 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. - * - * @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. + * 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. * @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. - * - * @param inData the IIOMetadata. - * @param imageType the ImageTypeSpecifier. - * @param param the ImageWriteParam. + * 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. * @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.image.RenderedImage; 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 @@ public class ImageTypeSpecifier { } /** - * 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 @@ public class ImageTypeSpecifier { } /** - * 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. + * 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 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. - * - * @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. + * 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 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. - * - * @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. + * 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 + * 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. - * - * @param bufferedImageType the buffered image type. + * Creates the ImageTypeSpecifier from the specified buffered image type. * + * @param bufferedImageType + * the buffered image type. * @return the ImageTypeSpecifier. */ public static ImageTypeSpecifier createFromBufferedImageType(int bufferedImageType) { @@ -216,11 +224,10 @@ public class ImageTypeSpecifier { } /** - * Creates the ImageTypeSpecifier from - * the specified RenderedImage. - * - * @param image the RenderedImage. + * Creates the ImageTypeSpecifier from the specified RenderedImage. * + * @param image + * the RenderedImage. * @return the ImageTypeSpecifier. */ public static ImageTypeSpecifier createFromRenderedImage(RenderedImage image) { @@ -242,7 +249,7 @@ public class ImageTypeSpecifier { /** * 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 @@ public class ImageTypeSpecifier { /** * 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 @@ public class ImageTypeSpecifier { /** * 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 @@ public class ImageTypeSpecifier { /** * 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 @@ public class ImageTypeSpecifier { /** * 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 @@ public class ImageTypeSpecifier { } /** - * Compares this ImageTypeSpecifier object with the specified - * object. - * - * @param o the Object to be compared. + * Compares this ImageTypeSpecifier object with the specified object. * - * @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 @@ public class ImageWriteParam extends IIOParam { } /** - * 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 @@ public class ImageWriteParam extends IIOParam { } /** - * 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 @@ public class ImageWriteParam extends IIOParam { } /** - * 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 @@ public class ImageWriteParam extends IIOParam { /** * 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 @@ public class ImageWriteParam extends IIOParam { /** * 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 @@ public class ImageWriteParam extends IIOParam { } /** - * 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 @@ public class ImageWriteParam extends IIOParam { } /** - * 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 @@ public class ImageWriteParam extends IIOParam { } /** - * 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 @@ public class ImageWriteParam extends IIOParam { } /** - * 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 @@ public class ImageWriteParam extends IIOParam { } /** - * 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 @@ public class ImageWriteParam extends IIOParam { } /** - * 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 @@ public class ImageWriteParam extends IIOParam { } /** - * 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 @@ public class ImageWriteParam extends IIOParam { } /** - * 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 @@ public class ImageWriteParam extends IIOParam { /** * 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 @@ public class ImageWriteParam extends IIOParam { } /** - * 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 @@ public class ImageWriteParam extends IIOParam { } /** - * 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 @@ public class ImageWriteParam extends IIOParam { 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 @@ public class ImageWriteParam extends IIOParam { } /** - * 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 @@ public class ImageWriteParam extends IIOParam { } } } - 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.metadata.IIOMetadata; 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 @@ public abstract class ImageWriter implements ImageTranscoder { /** * 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 @@ public abstract class ImageWriter implements ImageTranscoder { } /** - * 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 @@ public abstract class ImageWriter implements ImageTranscoder { } /** - * 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 @@ public abstract class ImageWriter implements ImageTranscoder { } /** - * 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 @@ public abstract class ImageWriter implements ImageTranscoder { } /** - * 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 @@ public abstract class ImageWriter implements ImageTranscoder { } /** - * 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 @@ public abstract class ImageWriter implements ImageTranscoder { 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 @@ public abstract class ImageWriter implements ImageTranscoder { } /** - * 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 @@ public abstract class ImageWriter implements ImageTranscoder { } /** - * 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. - * - * @param image the specified RenderedImage to be written. + * Writes a completed image stream that contains the specified rendered + * image, default metadata, and thumbnails to the output. * - * @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 @@ public abstract class ImageWriter implements ImageTranscoder { * 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 @@ public abstract class ImageWriter implements ImageTranscoder { } /** - * 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 @@ public abstract class ImageWriter implements ImageTranscoder { /** * 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 @@ public abstract class ImageWriter implements ImageTranscoder { /** * 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 @@ public abstract class ImageWriter implements ImageTranscoder { /** * 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 @@ public abstract class ImageWriter implements ImageTranscoder { /** * Check output return false. * - * @return true, if successful + * @return true, if successful. */ private final boolean checkOutputReturnFalse() { if (getOutput() == null) { @@ -385,124 +412,122 @@ public abstract class ImageWriter implements ImageTranscoder { 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. - * - * @param imageIndex the specified index of image. + * Returns true if a new image can be inserted at the specified index. * - * @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. - * - * @param imageIndex the specified index of image. + * Returns true if the image with the specified index can be removed. * - * @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. - * - * @param imageIndex the specified image index. + * Returns true if metadata of the image with the specified index can be + * replaced. * - * @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. - * - * @param imageIndex the image's index. + * Returns true if pixels of the image with the specified index can be + * replaced by the replacePixels methods. * - * @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. - * - * @return true if the stream metadata presented in the output - * can be removed, false otherwise. + * Returns true if the stream metadata presented in the output can be + * removed. * - * @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. - * - * @return true if the writing of a complete image stream which - * contains a single image is supported, false otherwise. + * 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. * - * @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 @@ public abstract class ImageWriter implements ImageTranscoder { /** * 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 @@ public abstract class ImageWriter implements ImageTranscoder { /** * 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 @@ public abstract class ImageWriter implements ImageTranscoder { /** * 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 @@ public abstract class ImageWriter implements ImageTranscoder { } /** - * Gets an IIOMetadata object that contains default values - * for encoding an image with the specified type. - * - * @param imageType the ImageTypeSpecifier. - * @param param the ImageWriteParam. + * Gets an IIOMetadata object that contains default values for encoding an + * image with the specified type. * + * @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. - * - * @param param the ImageWriteParam. + * Gets an IIOMetadata object that contains default values for encoding a + * stream of images. * + * @param param + * the ImageWriteParam. * @return the IIOMetadata object. */ public abstract IIOMetadata getDefaultStreamMetadata(ImageWriteParam param); @@ -591,9 +619,8 @@ public abstract class ImageWriter implements ImageTranscoder { } /** - * 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 @@ public abstract class ImageWriter implements ImageTranscoder { } /** - * 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. - * - * @param imageType the ImageTypeSpecifier. - * @param param the ImageWriteParam. - * @param streamMetadata the stream metadata. - * @param imageMetadata the image metadata. + * 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. * - * @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. - * - * @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. - */ - public void prepareInsertEmpty( - int imageIndex, ImageTypeSpecifier imageType, - int width, int height, - IIOMetadata imageMetadata, List<? extends BufferedImage> thumbnails, - ImageWriteParam param - ) throws IOException { + * 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 + * 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 { unsupportedOperation(); } /** - * Prepares the writer to call the replacePixels method for the - * specified region. - * - * @param imageIndex the image's index. - * @param region the specified region. + * Prepares the writer to call the replacePixels method for 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. - * - * @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. - */ - public void prepareWriteEmpty( - IIOMetadata streamMetadata, ImageTypeSpecifier imageType, - int width, int height, - IIOMetadata imageMetadata, List<? extends BufferedImage> thumbnails, - ImageWriteParam param - ) throws IOException { + * 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 + * 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 { unsupportedOperation(); } /** - * Prepares a stream to accept calls of writeToSequence method - * using the metadata object. - * - * @param streamMetadata the stream metadata. + * Prepares a stream to accept calls of writeToSequence method using the + * metadata object. * - * @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 @@ public abstract class ImageWriter implements ImageTranscoder { } /** - * 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 @@ public abstract class ImageWriter implements ImageTranscoder { } /** - * 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 @@ public abstract class ImageWriter implements ImageTranscoder { } /** - * 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 @@ public abstract class ImageWriter implements ImageTranscoder { /** * 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 @@ public abstract class ImageWriter implements ImageTranscoder { /** * 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 @@ public abstract class ImageWriter implements ImageTranscoder { /** * 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 @@ public abstract class ImageWriter implements ImageTranscoder { /** * 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. - * - * @param raster the Raster. - * @param param the ImageWriteParam. + * Replaces a part of an image presented in the output with the specified + * Raster. * - * @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 @@ public abstract class ImageWriter implements ImageTranscoder { /** * 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 @@ public abstract class ImageWriter implements ImageTranscoder { /** * 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 @@ public abstract class ImageWriter implements ImageTranscoder { } /** - * 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. + * Inserts image into existing output stream. * - * @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 @@ import javax.imageio.ImageReader; */ /** - * 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. + * 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. + * @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 imageUpdate(ImageReader source, BufferedImage theImage, 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 + * 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. + * @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. + * 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. + * @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); + 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 + * 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. + * @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 + * 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. + * @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); - + 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. + * 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 int values indicating the bands being 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); + 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 @@ import javax.imageio.ImageReader; */ /** - * 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 org.w3c.dom.Node; 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 @@ public class IIOInvalidTreeException extends IIOException { } /** - * 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.apache.harmony.x.imageio.metadata.IIOMetadataUtils; 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 - */ - protected IIOMetadata(boolean standardMetadataFormatSupported, - String nativeMetadataFormatName, - String nativeMetadataFormatClassName, - String[] extraMetadataFormatNames, - String[] extraMetadataFormatClassNames) { + * @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) { 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 @@ public abstract class IIOMetadata { /** * 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 @@ public abstract class IIOMetadata { /** * Gets the controller associated with this metadata document. * - * @return the controller + * @return the controller. */ public IIOMetadataController getController() { return controller; @@ -139,7 +159,7 @@ public abstract class IIOMetadata { /** * 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 @@ public abstract class IIOMetadata { /** * Activate the controller. * - * @return true, if successful + * @return true, if successful. */ public boolean activateController() { if (!hasController()) { @@ -160,7 +180,7 @@ public abstract class IIOMetadata { /** * Gets the default controller. * - * @return the default controller + * @return the default controller. */ public IIOMetadataController getDefaultController() { return defaultController; @@ -169,7 +189,7 @@ public abstract class IIOMetadata { /** * 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 @@ public abstract class IIOMetadata { /** * 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 @@ public abstract class IIOMetadata { /** * 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 @@ public abstract class IIOMetadata { /** * 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 @@ public abstract class IIOMetadata { /** * Gets the standard chroma node. * - * @return the standard chroma node + * @return the standard chroma node. */ protected IIOMetadataNode getStandardChromaNode() { return null; @@ -248,7 +265,7 @@ public abstract class IIOMetadata { /** * Gets the standard compression node. * - * @return the standard compression node + * @return the standard compression node. */ protected IIOMetadataNode getStandardCompressionNode() { return null; @@ -257,7 +274,7 @@ public abstract class IIOMetadata { /** * Gets the standard data node. * - * @return the standard data node + * @return the standard data node. */ protected IIOMetadataNode getStandardDataNode() { return null; @@ -266,7 +283,7 @@ public abstract class IIOMetadata { /** * Gets the standard dimension node. * - * @return the standard dimension node + * @return the standard dimension node. */ protected IIOMetadataNode getStandardDimensionNode() { return null; @@ -275,7 +292,7 @@ public abstract class IIOMetadata { /** * Gets the standard document node. * - * @return the standard document node + * @return the standard document node. */ protected IIOMetadataNode getStandardDocumentNode() { return null; @@ -284,7 +301,7 @@ public abstract class IIOMetadata { /** * Gets the standard text node. * - * @return the standard text node + * @return the standard text node. */ protected IIOMetadataNode getStandardTextNode() { return null; @@ -293,7 +310,7 @@ public abstract class IIOMetadata { /** * Gets the standard tile node. * - * @return the standard tile node + * @return the standard tile node. */ protected IIOMetadataNode getStandardTileNode() { return null; @@ -302,7 +319,7 @@ public abstract class IIOMetadata { /** * Gets the standard transparency node. * - * @return the standard transparency node + * @return the standard transparency node. */ protected IIOMetadataNode getStandardTransparencyNode() { return null; @@ -311,7 +328,7 @@ public abstract class IIOMetadata { /** * 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 @@ public abstract class IIOMetadata { 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 @@ public abstract class IIOMetadata { /** * 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 @@ package javax.imageio.metadata; */ /** - * 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 javax.imageio.ImageTypeSpecifier; 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. */ + + /** + * The CHILD_POLICY_ALL. + */ int CHILD_POLICY_ALL = 1; - - /** The CHILD_POLICY_SOME. */ + + /** + * The CHILD_POLICY_SOME. + */ int CHILD_POLICY_SOME = 2; - - /** The CHILD_POLICY_CHOICE. */ + + /** + * The CHILD_POLICY_CHOICE. + */ int CHILD_POLICY_CHOICE = 3; - - /** The CHILD_POLICY_SEQUENCE. */ + + /** + * The CHILD_POLICY_SEQUENCE. + */ int CHILD_POLICY_SEQUENCE = 4; - - /** The CHILD_POLICY_REPEAT. */ + + /** + * The CHILD_POLICY_REPEAT. + */ int CHILD_POLICY_REPEAT = 5; - - /** The maximum value for the child policy. */ + + /** + * The maximum value for the child policy. + */ int CHILD_POLICY_MAX = CHILD_POLICY_REPEAT; - /** The DATATYPE_STRING. */ + /** + * The DATATYPE_STRING. + */ int DATATYPE_STRING = 0; - - /** The DATATYPE_BOOLEAN. */ + + /** + * The DATATYPE_BOOLEAN. + */ int DATATYPE_BOOLEAN = 1; - - /** The DATATYPE_INTEGER. */ + + /** + * The DATATYPE_INTEGER. + */ int DATATYPE_INTEGER = 2; - - /** The DATATYPE_FLOAT. */ + + /** + * The DATATYPE_FLOAT. + */ int DATATYPE_FLOAT = 3; - - /** The DATATYPE_DOUBLE. */ + + /** + * The DATATYPE_DOUBLE. + */ int DATATYPE_DOUBLE = 4; - /** The VALUE_NONE. */ + /** + * The VALUE_NONE. + */ int VALUE_NONE = 0; - - /** The VALUE_ARBITRARY. */ + + /** + * The VALUE_ARBITRARY. + */ int VALUE_ARBITRARY = 1; - - /** The VALUE_RANGE. */ + + /** + * The VALUE_RANGE. + */ int VALUE_RANGE = 2; - - /** The VALUE_RANGE_MIN_INCLUSIVE_MASK. */ + + /** + * The VALUE_RANGE_MIN_INCLUSIVE_MASK. + */ int VALUE_RANGE_MIN_INCLUSIVE_MASK = 4; - - /** The VALUE_RANGE_MAX_INCLUSIVE_MASK. */ + + /** + * The VALUE_RANGE_MAX_INCLUSIVE_MASK. + */ int VALUE_RANGE_MAX_INCLUSIVE_MASK = 8; - - /** The VALUE_ENUMERATION. */ + + /** + * The VALUE_ENUMERATION. + */ int VALUE_ENUMERATION = 16; - - /** The VALUE_LIST. */ + + /** + * The VALUE_LIST. + */ int VALUE_LIST = 32; - - /** The VALUE_RANGE_MIN_INCLUSIVE. */ + + /** + * The VALUE_RANGE_MIN_INCLUSIVE. + */ int VALUE_RANGE_MIN_INCLUSIVE = VALUE_RANGE | VALUE_RANGE_MIN_INCLUSIVE_MASK; - - /** The VALUE_RANGE_MAX_INCLUSIVE. */ + + /** + * 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 + * 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. */ 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. - * - * @param elementName the element name - * @param attrName the attribute name - * - * @return the attribute's default value + * 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. */ 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. - * - * @param elementName the element name - * @param attrName the attribute name - * - * @return true, if 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. */ 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.AccessController; 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 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { } /** - * 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 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { 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. - */ - protected void addAttribute( - String elementName, String attrName, int dataType, - boolean required, int listMinLength, int listMaxLength - ) { + * @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) { if (attrName == null) { throw new IllegalArgumentException("attrName == null!"); } @@ -144,18 +168,21 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { /** * 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. - */ - protected void addAttribute( - String elementName, String attrName, int dataType, - boolean required, String defaultValue - ) { + * @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) { if (attrName == null) { throw new IllegalArgumentException("attrName == null!"); } @@ -177,20 +204,23 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { /** * 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. - */ - protected void addAttribute( - String elementName, String attrName, int dataType, - boolean required, String defaultValue, List<String> enumeratedValues - ) { + * @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) { if (attrName == null) { throw new IllegalArgumentException("attrName == null!"); } @@ -226,26 +256,30 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { /** * 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. - */ - protected void addAttribute( - String elementName, String attrName, int dataType, - boolean required, String defaultValue, - String minValue, String maxValue, - boolean minInclusive, boolean maxInclusive - ) { + * @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) { if (attrName == null) { throw new IllegalArgumentException("attrName == null!"); } @@ -272,20 +306,21 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { } /** - * 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. - */ - protected void addBooleanAttribute( - String elementName, String attrName, - boolean hasDefaultValue, boolean defaultValue - ) { + * @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) { String defaultVal = hasDefaultValue ? (defaultValue ? "TRUE" : "FALSE") : null; ArrayList<String> values = new ArrayList<String>(2); values.add("TRUE"); @@ -295,11 +330,13 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { } /** - * 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 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { } /** - * 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 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { } /** - * 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. - */ - protected void addElement( - String elementName, String parentName, - int minChildren, int maxChildren - ) { + * @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) { if (minChildren < 0) { throw new IllegalArgumentException("minChildren < 0!"); } @@ -365,19 +404,20 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { } /** - * 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. - */ - protected void addObjectValue( - String elementName, Class<?> classType, - int arrayMinLength, int arrayMaxLength - ) { + * @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) { Element element = findElement(elementName); ObjectValue objVal = new ObjectValue(); @@ -390,20 +430,20 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { } /** - * 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. - */ - protected <T> void addObjectValue( - String elementName, Class<T> classType, - boolean required, T defaultValue - ) { + * @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) { // note: reqired is an unused parameter Element element = findElement(elementName); @@ -416,22 +456,22 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { } /** - * 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. - */ - protected <T> void addObjectValue( - String elementName, Class<T> classType, - boolean required, T defaultValue, - List<? extends T> enumeratedValues - ) { + * @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) { // note: reqired is an unused parameter if (enumeratedValues == null || enumeratedValues.isEmpty()) { throw new IllegalArgumentException("enumeratedValues is empty or null"); @@ -444,7 +484,8 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { } } } 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 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { } /** - * 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. - */ - 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 - ) { + * @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) { Element element = findElement(elementName); ObjectValue<T> objVal = new ObjectValue<T>(); @@ -540,7 +583,7 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { 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 abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { 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 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { } /** - * 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 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { /** * 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 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { /** * 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 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { /** * 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 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { /** * 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 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { /** * 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 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { /** * 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.Element; 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 @@ public class IIOMetadataNode implements Element, NodeList { /** * 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 class IIOMetadataNode implements Element, NodeList { } 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 class IIOMetadataNode implements Element, NodeList { } 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 class IIOMetadataNode implements Element, NodeList { } 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 @@ public class IIOMetadataNode implements Element, NodeList { 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 @@ public class IIOMetadataNode implements Element, NodeList { 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 @@ public class IIOMetadataNode implements Element, NodeList { 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 @@ public class IIOMetadataNode implements Element, NodeList { 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 @@ public class IIOMetadataNode implements Element, NodeList { 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 @@ public class IIOMetadataNode implements Element, NodeList { 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 @@ public class IIOMetadataNode implements Element, NodeList { 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 @@ public class IIOMetadataNode implements Element, NodeList { } } - 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 @@ public class IIOMetadataNode implements Element, NodeList { 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 @@ public class IIOMetadataNode implements Element, NodeList { /** * 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 @@ public class IIOMetadataNode implements Element, NodeList { /** * 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 @@ public class IIOMetadataNode implements Element, NodeList { * 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 @@ public class IIOMetadataNode implements Element, NodeList { /** * 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 @@ public class IIOMetadataNode implements Element, NodeList { * 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 class IIOMetadataNode implements Element, NodeList { } 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 class IIOMetadataNode implements Element, NodeList { } 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 class IIOMetadataNode implements Element, NodeList { } 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 @@ class IIOStandardMetadataFormat extends IIOMetadataFormatImpl { } /** - * 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 @@ class IIOStandardMetadataFormat extends IIOMetadataFormatImpl { 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 @@ class IIOStandardMetadataFormat extends IIOMetadataFormatImpl { 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 @@ class IIOStandardMetadataFormat extends IIOMetadataFormatImpl { 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 @@ class IIOStandardMetadataFormat extends IIOMetadataFormatImpl { 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 @@ public class BMPImageWriteParam extends ImageWriteParam { /** * 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 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 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. */ + + /** + * 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 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 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 @@ public class JPEGHuffmanTable { /** * 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 @@ public class JPEGHuffmanTable { /** * 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 @@ public class JPEGHuffmanTable { } /** - * 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 @@ public class JPEGHuffmanTable { /** * 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 @@ public class JPEGHuffmanTable { 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 @@ package javax.imageio.plugins.jpeg; 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 @@ public class JPEGImageReadParam extends ImageReadParam { /** * 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 class JPEGImageReadParam extends ImageReadParam { */ 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 javax.imageio.ImageWriteParam; 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. */ + + /** + * 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" + "Minimum useful", "Visually lossless", "Maximum useful" }; - /** 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; - /** 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 @@ public class JPEGImageWriteParam extends ImageWriteParam { 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 @@ public class JPEGImageWriteParam extends ImageWriteParam { } /** - * 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. */ - private final static int MAX = 32767; + /** + * 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 @@ public class JPEGQTable { } /** - * 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. - * - * @param scaleFactor the scale factor of table. - * @param forceBaseline the force baseline flag, the values - * should be clamped if 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. * @return the new quantization table. */ public JPEGQTable getScaledInstance(float scaleFactor, boolean forceBaseline) { @@ -156,7 +159,7 @@ public class JPEGQTable { */ @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 @@ import org.apache.harmony.x.imageio.spi.RAFIOSSpi; */ /** - * 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 @@ public final class IIORegistry extends ServiceRegistry { 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 @@ public final class IIORegistry extends ServiceRegistry { * @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 @@ public final class IIORegistry extends ServiceRegistry { } /** - * 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 @@ public abstract class IIOServiceProvider implements RegisterableService { } /** - * Gets a description of this service provider. - * The result string should be localized for the specified - * Locale. - * - * @param locale 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. * @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 java.io.IOException; 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 @@ public abstract class ImageInputStreamSpi extends IIOServiceProvider implements /** * 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 @@ public abstract class ImageInputStreamSpi extends IIOServiceProvider implements } /** - * 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 @@ public abstract class ImageInputStreamSpi extends IIOServiceProvider implements } /** - * 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. - * - * @param input the input Object. - * @param useCache the flag indicating if a cache file - * is needed or not. - * @param cacheDir the cache directory. + * 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. * @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. - * - * @param input the input Object. + * 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. * @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.IOException; 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 @@ public abstract class ImageOutputStreamSpi extends IIOServiceProvider implements /** * 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 @@ public abstract class ImageOutputStreamSpi extends IIOServiceProvider implements } /** - * 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 @@ public abstract class ImageOutputStreamSpi extends IIOServiceProvider implements } /** - * 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. - * - * @param output the output Object. + * 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. * @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. - * - * @param output the output Object. - * @param useCache the flag indicating if cache file - * is needed or not. - * @param cacheDir the cache directory. + * 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. * @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 javax.imageio.ImageReader; 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 @@ public abstract class ImageReaderSpi extends ImageReaderWriterSpi { /** * 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 @@ public abstract class ImageReaderSpi extends ImageReaderWriterSpi { } /** - * 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 @@ public abstract class ImageReaderSpi extends ImageReaderWriterSpi { } /** - * 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. - * - * @param extension the a plugin specific extension object, or null. + * Returns an instance of the ImageReader implementation for this service + * provider. * + * @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. - * - * @param reader the ImageReader. + * Checks whether or not the specified ImageReader object is an instance of + * the ImageReader associated with this service provider or not. * - * @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 org.apache.harmony.x.imageio.metadata.IIOMetadataUtils; 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 @@ public abstract class ImageReaderWriterSpi extends IIOServiceProvider 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 @@ public abstract class ImageReaderWriterSpi extends IIOServiceProvider } /** - * 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. - * - * @param formatName the format name. + * Gets an IIOMetadataFormat object for the specified image metadata 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. - * - * @param formatName the format name. + * Gets an IIOMetadataFormat object for the specified stream metadata 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 @@ public abstract class ImageReaderWriterSpi extends IIOServiceProvider } /** - * 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 @@ public abstract class ImageReaderWriterSpi extends IIOServiceProvider } /** - * 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 @@ public abstract class ImageTranscoderSpi extends IIOServiceProvider } /** - * 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.awt.image.RenderedImage; 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 @@ public abstract class ImageWriterSpi extends ImageReaderWriterSpi { /** * 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 @@ public abstract class ImageWriterSpi extends ImageReaderWriterSpi { } /** - * 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 @@ public abstract class ImageWriterSpi extends ImageReaderWriterSpi { } /** - * 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 @@ public abstract class ImageWriterSpi extends ImageReaderWriterSpi { } /** - * Checks whether or not the ImageWriter implementation associated - * with this service provider can encode an image with - * the specified type. - * - * @param type the ImageTypeSpecifier. + * Checks whether or not the ImageWriter implementation associated with this + * service provider can encode an image with the specified type. * - * @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. - * - * @param extension the a plugin specific extension object, or null. + * Returns an instance of the ImageWriter implementation for this service + * provider. * + * @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. - * - * @param writer the ImageWriter. + * Checks whether or not the specified ImageWriter object is an instance of + * the ImageWriter associated with this service provider or not. * - * @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 @@ public class ServiceRegistry { } /** - * 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 @@ public class ServiceRegistry { } /** - * Registers the specified service provider object in the - * specified categories. - * - * @param provider the specified provider to be registered. - * @param category the category. + * Registers the specified service provider object in the specified + * categories. * - * @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 @@ public class ServiceRegistry { /** * 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 @@ public class ServiceRegistry { } /** - * 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. - * - * @param category the specified category. - * @param filter the specified filter. - * @param useOrdering the flag indicating that providers are ordered - * in the returned Iterator. + * 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. * @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. - * - * @param category the specified category. - * @param useOrdering the flag indicating that providers are ordered - * in the returned Iterator. + * 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. * @return the Iterator of service providers. */ @SuppressWarnings("unchecked") @@ -173,11 +183,11 @@ public class ServiceRegistry { } /** - * Gets the registered service provider object that has the - * specified class type. - * - * @param providerClass the specified provider class. + * Gets the registered service provider object that has the specified class + * type. * + * @param providerClass + * the specified provider class. * @return the service provider object. */ public <T> T getServiceProviderByClass(Class<T> providerClass) { @@ -185,28 +195,32 @@ public class ServiceRegistry { } /** - * 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. + * Sets an ordering between two service provider objects within the + * specified category. * - * @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. - * - * @param category the specified category. - * @param firstProvider the first provider. - * @param secondProvider the second provider. + * Unsets an ordering between two service provider objects within the + * specified category. * - * @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 @@ public class ServiceRegistry { /** * 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 @@ public class ServiceRegistry { } /** - * 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 @@ public class ServiceRegistry { } /** - * 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 @@ public class ServiceRegistry { * 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 @@ public class ServiceRegistry { /** * List. * - * @return the iterator< class<?>> + * @return the iterator< class<?>>. */ Iterator<Class<?>> list() { return categories.keySet().iterator(); @@ -330,7 +352,8 @@ public class ServiceRegistry { /** * Adds the category. * - * @param category the category + * @param category + * the category. */ void addCategory(Class<?> category) { categories.put(category, new ProvidersMap()); @@ -341,10 +364,11 @@ public class ServiceRegistry { * <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 @@ public class ServiceRegistry { 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 @@ public class ServiceRegistry { /** * 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 @@ public class ServiceRegistry { 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 @@ public class ServiceRegistry { * 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 @@ public class ServiceRegistry { /** * 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 @@ public class ServiceRegistry { */ 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 @@ public class ServiceRegistry { /** * Next. * - * @return the e + * @return the e. */ public E next() { if (nextObj == null) { @@ -486,7 +521,7 @@ public class ServiceRegistry { /** * Checks for next. * - * @return true, if successful + * @return true, if successful. */ public boolean hasNext() { return nextObj != null; @@ -500,7 +535,8 @@ public class ServiceRegistry { } /** - * 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. */ + + /** + * The is. + */ private InputStream is; - - /** The file. */ + + /** + * The file. + */ private File file; - - /** The raf. */ - private RandomAccessFile raf; + /** + * 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. + * Instantiates a new FileCacheImageInputStream from the specified + * InputStream and using the specified File as its cache directory. * - * @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 @@ public class FileCacheImageInputStream extends ImageInputStreamImpl { 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.OutputStream; 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 @@ public class FileCacheImageOutputStream extends ImageOutputStreamImpl { @Override public void write(int b) throws IOException { flushBits(); // See the flushBits method description - + raf.write(b); streamPos++; } @@ -148,7 +160,7 @@ public class FileCacheImageOutputStream extends ImageOutputStreamImpl { } 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 @@ public class FileCacheImageOutputStream extends ImageOutputStreamImpl { } raf.seek(pos); - streamPos = raf.getFilePointer(); + streamPos = raf.getFilePointer(); bitOffset = 0; } @@ -177,7 +189,7 @@ public class FileCacheImageOutputStream extends ImageOutputStreamImpl { 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.File; 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 @@ public class FileImageInputStream extends ImageInputStreamImpl { } /** - * 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 class FileImageInputStream extends ImageInputStreamImpl { 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. - * - * @param f the output File. + * Instantiates a new FileImageOutputStream with the specified 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 @@ public class FileImageOutputStream extends ImageOutputStreamImpl { 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 @@ public class IIOByteBuffer { /** * 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 @@ public class IIOByteBuffer { /** * 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 @@ public class IIOByteBuffer { /** * 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.io.IOException; 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 @@ public interface ImageInputStream extends DataInput { /** * 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. - * - * @param b the byte 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. * @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. - * - * @param b the byte array. - * @param off the offset. - * @param len the number of bytes to be read. + * 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. * @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. - * - * @param buf the IIOByteBuffer. - * @param len the number of bytes to be read. + * Reads the number of bytes specified by len parameter from the stream, and + * modifies the specified IIOByteBuffer with the byte array, offset, and + * length. * - * @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. - * - * @return a boolean value for read byte. + * Reads a byte from the stream and returns a boolean true value if it is + * non zero, false if it is zero. * - * @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. - * - * @return a unsigned byte value for read byte as int. + * Reads a byte from the stream and returns its value as an integer. * - * @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. - * - * @return a unsigned short value coded in an int. + * Reads 2 bytes from the stream and returns its value as an unsigned short. * - * @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. - * - * @return a unsigned int value as long. + * Reads 4 bytes from the stream and returns its 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 @@ public interface ImageInputStream extends DataInput { * 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. - * - * @param b the byte array. + * Reads number of bytes from the stream which is equal to the specified + * array's length, and stores them into this 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. - * - * @param s the short array. - * @param off the offset. - * @param len the number of shorts to be read. + * Reads the specified number of shorts from the stream, and stores the + * result into the specified array starting at the specified index offset. * - * @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. - * - * @param i the int array. - * @param off the offset. - * @param len the number of ints to be read. + * Reads the specified number of integer from the stream, and stores the + * result into the specified array starting at the specified index offset. * - * @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. - * - * @param f the float array. - * @param off the offset. - * @param len the number of floats to be read. + * Reads the specified number of floats from the stream, and stores the + * result into the specified array starting at the specified index offset. * - * @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. - * - * @param d the double array. - * @param off the offset. - * @param len the number of doubles to be read. + * Reads the specified number of doubles from the stream, and stores the + * result into the specified array starting at the specified index offset. * - * @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 @@ public interface ImageInputStream extends DataInput { * 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 @@ public interface ImageInputStream extends DataInput { * 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 @@ public interface ImageInputStream extends DataInput { * 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. - * - * @param n the number of bytes. + * Skips the specified number of bytes by moving stream position. * + * @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. - * - * @param n the number of bytes. + * Skips the specified number of bytes by moving stream position. * + * @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. - * - * @param pos the position. + * Flushes the initial position in this stream prior to the specified stream + * 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 @@ public interface ImageInputStream extends DataInput { 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.io.IOException; 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 @@ public abstract class ImageInputStreamImpl implements ImageInputStream { if (b < 0) { throw new EOFException("EOF reached"); } - return (byte) b; + return (byte)b; } public int readUnsignedByte() throws IOException { @@ -125,58 +142,57 @@ public abstract class ImageInputStreamImpl implements ImageInputStream { 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 abstract class ImageInputStreamImpl implements ImageInputStream { } 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 abstract class ImageInputStreamImpl implements ImageInputStream { } 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 abstract class ImageInputStreamImpl implements ImageInputStream { } 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 abstract class ImageInputStreamImpl implements ImageInputStream { } 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 @@ public abstract class ImageInputStreamImpl implements ImageInputStream { 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 abstract class ImageInputStreamImpl implements ImageInputStream { } 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 @@ public abstract class ImageInputStreamImpl implements ImageInputStream { /** * 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 @@ public abstract class ImageInputStreamImpl implements ImageInputStream { * 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 @@ public abstract class ImageInputStreamImpl implements ImageInputStream { /** * Pop. * - * @return the long + * @return the long. */ long pop() { return values[--pos]; @@ -374,7 +397,7 @@ public abstract class ImageInputStreamImpl implements ImageInputStream { /** * Checks if is empty. * - * @return true, if is empty + * @return true, if is empty. */ boolean isEmpty() { return pos == 0; @@ -383,7 +406,8 @@ public abstract class ImageInputStreamImpl implements ImageInputStream { /** * 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. - * - * @param b the int value, of which the 8 lowest bits - * will be written. + * Writes a single byte to the stream at the current position. * - * @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. - * - * @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. + * 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 + * 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. - * - * @param b the boolean value to be written. + * Writes the specified boolean value to the stream, 1 if it is true, 0 if + * it is false. * - * @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. - * - * @param v the short value to be written. + * Writes a short value to the output stream. * - * @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. - * - * @param v the integer value to be written. + * Writes an integer value to the output stream. * - * @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. - * - * @param v the float which contains value to be written. + * Writes a float value to the output stream. * - * @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. - * - * @param s the specified string to be written. + * Writes 2 bytes to the output stream in the modified UTF-8 representation + * of every character of the specified string. * - * @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. - * - * @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. + * 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 + * 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. - * - * @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. + * Writes a len number of integer values from the specified array to the + * stream. + * + * @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. - * - * @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. + * 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 + * 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. - * - * @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. + * 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 + * 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. - * - * @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. + * 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 + * 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. - * - * @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. + * Writes a sequence of bits beginning from the current position. + * + * @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 @@ import java.nio.ByteOrder; */ /** - * 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 @@ public abstract class ImageOutputStreamImpl extends ImageInputStreamImpl } else { } - //-- TODO implement + // -- TODO implement throw new UnsupportedOperationException("Not implemented yet"); } @@ -76,7 +80,7 @@ public abstract class ImageOutputStreamImpl extends ImageInputStreamImpl } else { } - //-- TODO implement + // -- TODO implement throw new UnsupportedOperationException("Not implemented yet"); } @@ -86,7 +90,7 @@ public abstract class ImageOutputStreamImpl extends ImageInputStreamImpl } else { } - //-- TODO implement + // -- TODO implement throw new UnsupportedOperationException("Not implemented yet"); } @@ -108,62 +112,63 @@ public abstract class ImageOutputStreamImpl extends ImageInputStreamImpl } 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.IOException; 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 org.apache.harmony.x.imageio.stream.RandomAccessMemoryCache; 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 @@ public class MemoryCacheImageOutputStream extends ImageOutputStreamImpl { 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> |