summaryrefslogtreecommitdiffstats
path: root/awt/javax/imageio/spi
diff options
context:
space:
mode:
Diffstat (limited to 'awt/javax/imageio/spi')
-rw-r--r--awt/javax/imageio/spi/IIORegistry.java115
-rw-r--r--awt/javax/imageio/spi/IIOServiceProvider.java105
-rw-r--r--awt/javax/imageio/spi/ImageInputStreamSpi.java131
-rw-r--r--awt/javax/imageio/spi/ImageOutputStreamSpi.java132
-rw-r--r--awt/javax/imageio/spi/ImageReaderSpi.java204
-rw-r--r--awt/javax/imageio/spi/ImageReaderWriterSpi.java344
-rw-r--r--awt/javax/imageio/spi/ImageTranscoderSpi.java76
-rw-r--r--awt/javax/imageio/spi/ImageWriterSpi.java227
-rw-r--r--awt/javax/imageio/spi/RegisterableService.java54
-rw-r--r--awt/javax/imageio/spi/ServiceRegistry.java552
-rw-r--r--awt/javax/imageio/spi/package.html8
11 files changed, 0 insertions, 1948 deletions
diff --git a/awt/javax/imageio/spi/IIORegistry.java b/awt/javax/imageio/spi/IIORegistry.java
deleted file mode 100644
index 01ddeaa..0000000
--- a/awt/javax/imageio/spi/IIORegistry.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @author Rustem V. Rafikov
- * @version $Revision: 1.3 $
- */
-
-package javax.imageio.spi;
-
-import java.util.Arrays;
-
-import org.apache.harmony.x.imageio.plugins.jpeg.JPEGImageReaderSpi;
-import org.apache.harmony.x.imageio.plugins.jpeg.JPEGImageWriterSpi;
-import org.apache.harmony.x.imageio.plugins.png.PNGImageReaderSpi;
-import org.apache.harmony.x.imageio.plugins.png.PNGImageWriterSpi;
-import org.apache.harmony.x.imageio.spi.FileIISSpi;
-import org.apache.harmony.x.imageio.spi.FileIOSSpi;
-import org.apache.harmony.x.imageio.spi.InputStreamIISSpi;
-import org.apache.harmony.x.imageio.spi.OutputStreamIOSSpi;
-import org.apache.harmony.x.imageio.spi.RAFIISSpi;
-import org.apache.harmony.x.imageio.spi.RAFIOSSpi;
-
-/*
- * @author Rustem V. Rafikov, Viskov Nikolay
- * @version $Revision: 1.3 $
- */
-
-/**
- * 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.
- */
- private static IIORegistry instance;
-
- /**
- * 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
- };
-
- /**
- * Instantiates a new IIO registry.
- */
- private IIORegistry() {
- super(Arrays.<Class<?>> asList(CATEGORIES).iterator());
- registerBuiltinSpis();
- registerApplicationClasspathSpis();
- }
-
- /**
- * Register built-in SPIs.
- */
- private void registerBuiltinSpis() {
- registerServiceProvider(new JPEGImageWriterSpi());
- registerServiceProvider(new JPEGImageReaderSpi());
- registerServiceProvider(new PNGImageReaderSpi());
- registerServiceProvider(new PNGImageWriterSpi());
- registerServiceProvider(new FileIOSSpi());
- registerServiceProvider(new FileIISSpi());
- registerServiceProvider(new RAFIOSSpi());
- registerServiceProvider(new RAFIISSpi());
- registerServiceProvider(new OutputStreamIOSSpi());
- registerServiceProvider(new InputStreamIISSpi());
- // -- TODO implement
- }
-
- /**
- * Gets the default IIORegistry instance.
- *
- * @return the default IIORegistry instance.
- */
- public static IIORegistry getDefaultInstance() {
- // TODO implement own instance for each ThreadGroup (see also
- // ThreadLocal)
- synchronized (IIORegistry.class) {
- if (instance == null) {
- instance = new IIORegistry();
- }
- return instance;
- }
- }
-
- /**
- * Registers all service providers from the application class path.
- */
- public void registerApplicationClasspathSpis() {
- // -- TODO implement for non-builtin plugins
- }
-}
diff --git a/awt/javax/imageio/spi/IIOServiceProvider.java b/awt/javax/imageio/spi/IIOServiceProvider.java
deleted file mode 100644
index e947677..0000000
--- a/awt/javax/imageio/spi/IIOServiceProvider.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @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).
- *
- * @since Android 1.0
- */
-public abstract class IIOServiceProvider implements RegisterableService {
-
- /**
- * The vendor name of this service provider.
- */
- protected String vendorName;
-
- /**
- * 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.
- */
- public IIOServiceProvider(String vendorName, String version) {
- if (vendorName == null) {
- throw new NullPointerException("vendor name cannot be NULL");
- }
- if (version == null) {
- throw new NullPointerException("version name cannot be NULL");
- }
- this.vendorName = vendorName;
- this.version = version;
- }
-
- /**
- * Instantiates a new IIOServiceProvider.
- */
- public IIOServiceProvider() {
- throw new UnsupportedOperationException("Not supported yet");
- }
-
- public void onRegistration(ServiceRegistry registry, Class<?> category) {
- // the default impl. does nothing
- }
-
- public void onDeregistration(ServiceRegistry registry, Class<?> category) {
- throw new UnsupportedOperationException("Not supported yet");
- }
-
- /**
- * Gets the vendor name of this service provider.
- *
- * @return the vendor name of this service provider.
- */
- public String getVendorName() {
- return vendorName;
- }
-
- /**
- * Gets the version of this service provider.
- *
- * @return the version of this service provider.
- */
- public String getVersion() {
- return version;
- }
-
- /**
- * 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
deleted file mode 100644
index fc859a8..0000000
--- a/awt/javax/imageio/spi/ImageInputStreamSpi.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @author Rustem V. Rafikov
- * @version $Revision: 1.3 $
- */
-
-package javax.imageio.spi;
-
-import java.io.File;
-import java.io.IOException;
-import javax.imageio.stream.ImageInputStream;
-
-/**
- * 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.
- */
- protected Class<?> inputClass;
-
- /**
- * Instantiates a new ImageInputStreamSpi.
- */
- protected ImageInputStreamSpi() {
- throw new UnsupportedOperationException("Not supported yet");
- }
-
- /**
- * Instantiates a new ImageInputStreamSpi.
- *
- * @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);
- this.inputClass = inputClass;
- }
-
- /**
- * Gets an input Class object that represents class or interface that must
- * be implemented by an input source.
- *
- * @return the input class.
- */
- public Class<?> getInputClass() {
- return inputClass;
- }
-
- /**
- * 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.
- */
- public boolean canUseCacheFile() {
- return false; // -- def
- }
-
- /**
- * 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.
- */
- 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 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
- * 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.
- * @return the ImageInputStream.
- * @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
deleted file mode 100644
index b7a9a5c..0000000
--- a/awt/javax/imageio/spi/ImageOutputStreamSpi.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @author Rustem V. Rafikov
- * @version $Revision: 1.3 $
- */
-
-package javax.imageio.spi;
-
-import javax.imageio.stream.ImageOutputStream;
-import java.io.IOException;
-import java.io.File;
-
-/**
- * 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.
- */
- protected Class<?> outputClass;
-
- /**
- * Instantiates a new ImageOutputStreamSpi.
- */
- protected ImageOutputStreamSpi() {
- throw new UnsupportedOperationException("Not supported yet");
- }
-
- /**
- * Instantiates a new ImageOutputStreamSpi.
- *
- * @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);
- this.outputClass = outputClass;
- }
-
- /**
- * Gets an output Class object that represents the class or interface that
- * must be implemented by an output source.
- *
- * @return the output class.
- */
- public Class<?> getOutputClass() {
- return outputClass;
- }
-
- /**
- * 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.
- */
- public boolean canUseCacheFile() {
- return false; // def
- }
-
- /**
- * 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.
- */
- 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.
- * @return the ImageOutputStream.
- * @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.
- * @return the ImageOutputStream.
- * @throws IOException
- * if an I/O exception has occurred.
- */
- 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
deleted file mode 100644
index 0528d25..0000000
--- a/awt/javax/imageio/spi/ImageReaderSpi.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @author Rustem V. Rafikov
- * @version $Revision: 1.3 $
- */
-
-package javax.imageio.spi;
-
-import javax.imageio.stream.ImageInputStream;
-import javax.imageio.ImageReader;
-import java.io.IOException;
-
-/**
- * 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.
- */
- public static final Class[] STANDARD_INPUT_TYPE = new Class[] {
- ImageInputStream.class
- };
-
- /**
- * The input types.
- */
- protected Class[] inputTypes;
-
- /**
- * The writer SPI names.
- */
- protected String[] writerSpiNames;
-
- /**
- * Instantiates a new ImageReaderSpi.
- */
- protected ImageReaderSpi() {
- throw new UnsupportedOperationException("Not supported yet");
- }
-
- /**
- * 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 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) {
- super(vendorName, version, names, suffixes, MIMETypes, pluginClassName,
- supportsStandardStreamMetadataFormat, nativeStreamMetadataFormatName,
- nativeStreamMetadataFormatClassName, extraStreamMetadataFormatNames,
- extraStreamMetadataFormatClassNames, supportsStandardImageMetadataFormat,
- nativeImageMetadataFormatName, nativeImageMetadataFormatClassName,
- extraImageMetadataFormatNames, extraImageMetadataFormatClassNames);
-
- if (inputTypes == null || inputTypes.length == 0) {
- throw new NullPointerException("input types array cannot be NULL or empty");
- }
- this.inputTypes = inputTypes;
- this.writerSpiNames = writerSpiNames;
- }
-
- /**
- * Gets an array of Class objects whose types can be used as input for this
- * reader.
- *
- * @return the input types.
- */
- public Class[] getInputTypes() {
- return inputTypes;
- }
-
- /**
- * 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
- * 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.
- *
- * @return the ImageReader.
- * @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 plug-in specific extension object, or null.
- * @return the ImageReader.
- * @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.
- * @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.
- *
- * @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
deleted file mode 100644
index 9ca08b5..0000000
--- a/awt/javax/imageio/spi/ImageReaderWriterSpi.java
+++ /dev/null
@@ -1,344 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @author Rustem V. Rafikov
- * @version $Revision: 1.3 $
- */
-
-package javax.imageio.spi;
-
-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.
- *
- * @since Android 1.0
- */
-public abstract class ImageReaderWriterSpi extends IIOServiceProvider implements
- RegisterableService {
-
- /**
- * The names.
- */
- protected String[] names;
-
- /**
- * The suffixes.
- */
- protected String[] suffixes;
-
- /**
- * The MIME types.
- */
- protected String[] MIMETypes;
-
- /**
- * The plug-in class name.
- */
- protected String pluginClassName;
-
- /**
- * Whether the reader/writer supports standard stream metadata format.
- */
- protected boolean supportsStandardStreamMetadataFormat;
-
- /**
- * The native stream metadata format name.
- */
- protected String nativeStreamMetadataFormatName;
-
- /**
- * The native stream metadata format class name.
- */
- protected String nativeStreamMetadataFormatClassName;
-
- /**
- * The extra stream metadata format names.
- */
- protected String[] extraStreamMetadataFormatNames;
-
- /**
- * The extra stream metadata format class names.
- */
- protected String[] extraStreamMetadataFormatClassNames;
-
- /**
- * Whether the reader/writer supports standard image metadata format.
- */
- protected boolean supportsStandardImageMetadataFormat;
-
- /**
- * The native image metadata format name.
- */
- protected String nativeImageMetadataFormatName;
-
- /**
- * The native image metadata format class name.
- */
- protected String nativeImageMetadataFormatClassName;
-
- /**
- * The extra image metadata format names.
- */
- protected String[] extraImageMetadataFormatNames;
-
- /**
- * 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 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) {
- super(vendorName, version);
-
- if (names == null || names.length == 0) {
- throw new NullPointerException("format names array cannot be NULL or empty");
- }
-
- if (pluginClassName == null) {
- throw new NullPointerException("Plugin class name cannot be NULL");
- }
-
- // We clone all the arrays to be consistent with the fact that
- // some methods of this class must return clones of the arrays
- // as it is stated in the spec.
- this.names = names.clone();
- this.suffixes = suffixes == null ? null : suffixes.clone();
- this.MIMETypes = MIMETypes == null ? null : MIMETypes.clone();
- this.pluginClassName = pluginClassName;
- this.supportsStandardStreamMetadataFormat = supportsStandardStreamMetadataFormat;
- this.nativeStreamMetadataFormatName = nativeStreamMetadataFormatName;
- this.nativeStreamMetadataFormatClassName = nativeStreamMetadataFormatClassName;
-
- this.extraStreamMetadataFormatNames = extraStreamMetadataFormatNames == null ? null
- : extraStreamMetadataFormatNames.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.extraImageMetadataFormatClassNames = extraImageMetadataFormatClassNames == null ? null
- : extraImageMetadataFormatClassNames.clone();
- }
-
- /**
- * Instantiates a new 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.
- *
- * @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.
- *
- * @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.
- *
- * @return the array of extra image metadata format names.
- */
- public String[] getExtraImageMetadataFormatNames() {
- return extraImageMetadataFormatNames == null ? null : extraImageMetadataFormatNames.clone();
- }
-
- /**
- * 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();
- }
-
- /**
- * 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);
- }
-
- /**
- * 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);
- }
-
- /**
- * 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.
- */
- public String[] getMIMETypes() {
- return MIMETypes == null ? null : MIMETypes.clone();
- }
-
- /**
- * 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.
- */
- 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.
- *
- * @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.
- *
- * @return the class name.
- */
- public String getPluginClassName() {
- return pluginClassName;
- }
-
- /**
- * 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.
- */
- 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.
- *
- * @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
deleted file mode 100644
index 742af19..0000000
--- a/awt/javax/imageio/spi/ImageTranscoderSpi.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @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.
- *
- * @since Android 1.0
- */
-public abstract class ImageTranscoderSpi extends IIOServiceProvider implements RegisterableService {
-
- /**
- * Instantiates a new ImageTranscoderSpi.
- */
- protected ImageTranscoderSpi() {
- }
-
- /**
- * Instantiates a new ImageTranscoderSpi with the specified vendor name and
- * 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.
- *
- * @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.
- *
- * @return the class name of an ImageWriterSpi.
- */
- public abstract String getWriterServiceProviderName();
-
- /**
- * Creates an instance of the ImageTranscoder associated with this service
- * provider.
- *
- * @return the ImageTranscoder instance.
- */
- public abstract ImageTranscoder createTranscoderInstance();
-}
diff --git a/awt/javax/imageio/spi/ImageWriterSpi.java b/awt/javax/imageio/spi/ImageWriterSpi.java
deleted file mode 100644
index bf25455..0000000
--- a/awt/javax/imageio/spi/ImageWriterSpi.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @author Rustem V. Rafikov
- * @version $Revision: 1.3 $
- */
-
-package javax.imageio.spi;
-
-import javax.imageio.stream.ImageInputStream;
-import javax.imageio.ImageTypeSpecifier;
-import javax.imageio.ImageWriter;
-import java.awt.image.RenderedImage;
-import java.io.IOException;
-
-/**
- * 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 output types.
- */
- protected Class[] outputTypes;
-
- /**
- * The reader SPI names.
- */
- protected String[] readerSpiNames;
-
- /**
- * Instantiates a new ImageWriterSpi.
- */
- protected ImageWriterSpi() {
- throw new UnsupportedOperationException("Not supported yet");
- }
-
- /**
- * 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 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) {
- super(vendorName, version, names, suffixes, MIMETypes, pluginClassName,
- supportsStandardStreamMetadataFormat, nativeStreamMetadataFormatName,
- nativeStreamMetadataFormatClassName, extraStreamMetadataFormatNames,
- extraStreamMetadataFormatClassNames, supportsStandardImageMetadataFormat,
- nativeImageMetadataFormatName, nativeImageMetadataFormatClassName,
- extraImageMetadataFormatNames, extraImageMetadataFormatClassNames);
-
- if (outputTypes == null || outputTypes.length == 0) {
- throw new NullPointerException("output types array cannot be NULL or empty");
- }
-
- this.outputTypes = outputTypes;
- this.readerSpiNames = readerSpiNames;
- }
-
- /**
- * 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.
- */
- public boolean isFormatLossless() {
- return true;
- }
-
- /**
- * Gets an array of Class objects whose types can be used as output for this
- * writer.
- *
- * @return the output types.
- */
- public Class[] getOutputTypes() {
- return outputTypes;
- }
-
- /**
- * Checks whether or not the ImageWriter implementation associated with this
- * service provider can encode an image with the specified type.
- *
- * @param type
- * the ImageTypeSpecifier.
- * @return true, if an image with the specified type can be encoded, false
- * otherwise.
- */
- public abstract boolean canEncodeImage(ImageTypeSpecifier type);
-
- /**
- * 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.
- */
- public boolean canEncodeImage(RenderedImage im) {
- return canEncodeImage(ImageTypeSpecifier.createFromRenderedImage(im));
- }
-
- /**
- * Returns an instance of the ImageWriter implementation for this service
- * provider.
- *
- * @return the ImageWriter.
- * @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 plug-in specific extension object, or null.
- * @return the ImageWriter.
- * @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.
- * @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.
- *
- * @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
deleted file mode 100644
index ae2f4d3..0000000
--- a/awt/javax/imageio/spi/RegisterableService.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @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.
- *
- * @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.
- *
- * @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.
- *
- * @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
deleted file mode 100644
index 79b02a3..0000000
--- a/awt/javax/imageio/spi/ServiceRegistry.java
+++ /dev/null
@@ -1,552 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @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.
- *
- * @since Android 1.0
- */
-public class ServiceRegistry {
-
- /**
- * 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.
- */
- public ServiceRegistry(Iterator<Class<?>> categoriesIterator) {
- if (null == categoriesIterator) {
- throw new IllegalArgumentException("categories iterator should not be NULL");
- }
- while (categoriesIterator.hasNext()) {
- Class<?> c = categoriesIterator.next();
- categories.addCategory(c);
- }
- }
-
- /**
- * 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.
- * @return the iterator of providers objects for this service.
- */
- public static <T> Iterator<T> lookupProviders(Class<T> providerClass, ClassLoader loader) {
- throw new UnsupportedOperationException("Not supported yet");
- }
-
- /**
- * 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.
- * @return the iterator of providers objects for this service.
- */
- public static <T> Iterator<T> lookupProviders(Class<T> providerClass) {
- return lookupProviders(providerClass, Thread.currentThread().getContextClassLoader());
- }
-
- /**
- * Registers the specified service provider object in the specified
- * categories.
- *
- * @param provider
- * the specified provider to be registered.
- * @param category
- * the category.
- * @return true, if no provider of the same class is registered in this
- * category, false otherwise.
- */
- public <T> boolean registerServiceProvider(T provider, Class<T> category) {
- return categories.addProvider(provider, category);
- }
-
- /**
- * Registers a list of service providers.
- *
- * @param providers
- * the list of service providers.
- */
- public void registerServiceProviders(Iterator<?> providers) {
- for (Iterator<?> iterator = providers; iterator.hasNext();) {
- categories.addProvider(iterator.next(), null);
- }
- }
-
- /**
- * Registers the specified service provider object in all categories.
- *
- * @param provider
- * the service provider.
- */
- public void registerServiceProvider(Object provider) {
- categories.addProvider(provider, null);
- }
-
- /**
- * 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.
- */
- public <T> boolean deregisterServiceProvider(T provider, Class<T> category) {
- throw new UnsupportedOperationException("Not supported yet");
- }
-
- /**
- * Deregisters the specified service provider from all categories.
- *
- * @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.
- * @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));
- }
-
- /**
- * 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")
- public <T> Iterator<T> getServiceProviders(Class<T> category, boolean useOrdering) {
- return (Iterator<T>)categories.getProviders(category, useOrdering);
- }
-
- /**
- * 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) {
- throw new UnsupportedOperationException("Not supported yet");
- }
-
- /**
- * Sets an ordering between two service provider objects within the
- * specified category.
- *
- * @param category
- * the specified category.
- * @param firstProvider
- * the first provider.
- * @param secondProvider
- * the second provider.
- * @return true, if a previously unset order was set.
- */
- 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.
- * @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");
- }
-
- /**
- * Deregisters all providers from the specified category.
- *
- * @param category
- * the specified category.
- */
- public void deregisterAll(Class<?> category) {
- throw new UnsupportedOperationException("Not supported yet");
- }
-
- /**
- * Deregister all providers from all categories.
- */
- public void deregisterAll() {
- throw new UnsupportedOperationException("Not supported yet");
- }
-
- /**
- * Finalizes this object.
- *
- * @throws Throwable
- * if an error occurs during finalization.
- */
- @Override
- public void finalize() throws Throwable {
- // TODO uncomment when deregisterAll is implemented
- // deregisterAll();
- }
-
- /**
- * Checks whether the specified provider has been already registered.
- *
- * @param provider
- * the provider to be checked.
- * @return true, if the specified provider has been already registered,
- * false otherwise.
- */
- public boolean contains(Object provider) {
- throw new UnsupportedOperationException("Not supported yet");
- }
-
- /**
- * Gets an iterator of Class objects representing the current categories.
- *
- * @return the Iterator of Class objects.
- */
- public Iterator<Class<?>> getCategories() {
- return categories.list();
- }
-
- /**
- * 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.
- *
- * @param provider
- * the provider.
- * @return true, if the specified provider satisfies the criterion of
- * this Filter, false otherwise.
- */
- boolean filter(Object provider);
- }
-
- /**
- * The Class CategoriesMap.
- */
- private static class CategoriesMap {
-
- /**
- * The categories.
- */
- Map<Class<?>, ProvidersMap> categories = new HashMap<Class<?>, ProvidersMap>();
-
- /**
- * The registry.
- */
- ServiceRegistry registry;
-
- /**
- * Instantiates a new categories map.
- *
- * @param registry
- * the registry.
- */
- public CategoriesMap(ServiceRegistry registry) {
- this.registry = registry;
- }
-
- // -- TODO: useOrdering
- /**
- * Gets 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);
- if (null == providers) {
- throw new IllegalArgumentException("Unknown category: " + category);
- }
- return providers.getProviders(useOrdering);
- }
-
- /**
- * List.
- *
- * @return the iterator< class<?>>.
- */
- Iterator<Class<?>> list() {
- return categories.keySet().iterator();
- }
-
- /**
- * Adds the category.
- *
- * @param category
- * the category.
- */
- void addCategory(Class<?> category) {
- categories.put(category, new ProvidersMap());
- }
-
- /**
- * Adds a provider to the category. If <code>category</code> is
- * <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 true, if there were such provider in some category.
- */
- boolean addProvider(Object provider, Class<?> category) {
- if (provider == null) {
- throw new IllegalArgumentException("provider should be != NULL");
- }
-
- boolean rt;
- if (category == null) {
- rt = findAndAdd(provider);
- } else {
- rt = addToNamed(provider, category);
- }
-
- if (provider instanceof RegisterableService) {
- ((RegisterableService)provider).onRegistration(registry, category);
- }
-
- return rt;
- }
-
- /**
- * Adds the to named.
- *
- * @param provider
- * the provider.
- * @param category
- * the category.
- * @return true, if successful.
- */
- private boolean addToNamed(Object provider, Class<?> category) {
- Object obj = categories.get(category);
-
- if (null == obj) {
- throw new IllegalArgumentException("Unknown category: " + category);
- }
-
- return ((ProvidersMap)obj).addProvider(provider);
- }
-
- /**
- * Find and add.
- *
- * @param provider
- * the provider.
- * @return true, if successful.
- */
- private boolean findAndAdd(Object provider) {
- boolean rt = false;
- for (Entry<Class<?>, ProvidersMap> e : categories.entrySet()) {
- if (e.getKey().isAssignableFrom(provider.getClass())) {
- rt |= e.getValue().addProvider(provider);
- }
- }
- return rt;
- }
- }
-
- /**
- * The Class ProvidersMap.
- */
- private static class ProvidersMap {
- // -- TODO: providers ordering support
-
- /**
- * The providers.
- */
- Map<Class<?>, Object> providers = new HashMap<Class<?>, Object>();
-
- /**
- * Adds the provider.
- *
- * @param provider
- * the provider.
- * @return true, if successful.
- */
- boolean addProvider(Object provider) {
- return providers.put(provider.getClass(), provider) != null;
- }
-
- /**
- * Gets the provider classes.
- *
- * @return the provider classes.
- */
- Iterator<Class<?>> getProviderClasses() {
- return providers.keySet().iterator();
- }
-
- // -- TODO ordering
- /**
- * Gets the providers.
- *
- * @param userOrdering
- * the user ordering.
- * @return the providers.
- */
- Iterator<?> getProviders(boolean userOrdering) {
- return providers.values().iterator();
- }
- }
-
- /**
- * The Class FilteredIterator.
- */
- private static class FilteredIterator<E> implements Iterator<E> {
-
- /**
- * The filter.
- */
- private Filter filter;
-
- /**
- * The backend.
- */
- private Iterator<E> backend;
-
- /**
- * The next obj.
- */
- private E nextObj;
-
- /**
- * Instantiates a new filtered iterator.
- *
- * @param filter
- * the filter.
- * @param backend
- * the backend.
- */
- public FilteredIterator(Filter filter, Iterator<E> backend) {
- this.filter = filter;
- this.backend = backend;
- findNext();
- }
-
- /**
- * Next.
- *
- * @return the e.
- */
- public E next() {
- if (nextObj == null) {
- throw new NoSuchElementException();
- }
- E tmp = nextObj;
- findNext();
- return tmp;
- }
-
- /**
- * Checks for next.
- *
- * @return true, if successful.
- */
- public boolean hasNext() {
- return nextObj != null;
- }
-
- /**
- * Removes the.
- */
- public void remove() {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Sets nextObj to a next provider matching the criterion given by the
- * filter.
- */
- private void findNext() {
- nextObj = null;
- while (backend.hasNext()) {
- E o = backend.next();
- if (filter.filter(o)) {
- nextObj = o;
- return;
- }
- }
- }
- }
-}
diff --git a/awt/javax/imageio/spi/package.html b/awt/javax/imageio/spi/package.html
deleted file mode 100644
index 18ceff4..0000000
--- a/awt/javax/imageio/spi/package.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<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>