diff options
Diffstat (limited to 'awt/javax/imageio/spi')
-rw-r--r-- | awt/javax/imageio/spi/IIORegistry.java | 47 | ||||
-rw-r--r-- | awt/javax/imageio/spi/IIOServiceProvider.java | 32 | ||||
-rw-r--r-- | awt/javax/imageio/spi/ImageInputStreamSpi.java | 93 | ||||
-rw-r--r-- | awt/javax/imageio/spi/ImageOutputStreamSpi.java | 92 | ||||
-rw-r--r-- | awt/javax/imageio/spi/ImageReaderSpi.java | 186 | ||||
-rw-r--r-- | awt/javax/imageio/spi/ImageReaderWriterSpi.java | 317 | ||||
-rw-r--r-- | awt/javax/imageio/spi/ImageTranscoderSpi.java | 34 | ||||
-rw-r--r-- | awt/javax/imageio/spi/ImageWriterSpi.java | 200 | ||||
-rw-r--r-- | awt/javax/imageio/spi/RegisterableService.java | 36 | ||||
-rw-r--r-- | awt/javax/imageio/spi/ServiceRegistry.java | 320 | ||||
-rw-r--r-- | awt/javax/imageio/spi/package.html | 8 |
11 files changed, 752 insertions, 613 deletions
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> |