001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: /**
018: * @author Rustem V. Rafikov
019: * @version $Revision: 1.3 $
020: */package javax.imageio.spi;
021:
022: import javax.imageio.stream.ImageInputStream;
023: import javax.imageio.ImageReader;
024:
025: import org.apache.harmony.luni.util.NotImplementedException;
026:
027: import java.io.IOException;
028:
029: public abstract class ImageReaderSpi extends ImageReaderWriterSpi {
030:
031: public static final Class[] STANDARD_INPUT_TYPE = new Class[] { ImageInputStream.class };
032:
033: protected Class[] inputTypes;
034: protected String[] writerSpiNames;
035:
036: protected ImageReaderSpi() throws NotImplementedException {
037: // TODO: implement
038: throw new NotImplementedException();
039: }
040:
041: public ImageReaderSpi(String vendorName, String version,
042: String[] names, String[] suffixes, String[] MIMETypes,
043: String pluginClassName, Class[] inputTypes,
044: String[] writerSpiNames,
045: boolean supportsStandardStreamMetadataFormat,
046: String nativeStreamMetadataFormatName,
047: String nativeStreamMetadataFormatClassName,
048: String[] extraStreamMetadataFormatNames,
049: String[] extraStreamMetadataFormatClassNames,
050: boolean supportsStandardImageMetadataFormat,
051: String nativeImageMetadataFormatName,
052: String nativeImageMetadataFormatClassName,
053: String[] extraImageMetadataFormatNames,
054: String[] extraImageMetadataFormatClassNames) {
055: super (vendorName, version, names, suffixes, MIMETypes,
056: pluginClassName, supportsStandardStreamMetadataFormat,
057: nativeStreamMetadataFormatName,
058: nativeStreamMetadataFormatClassName,
059: extraStreamMetadataFormatNames,
060: extraStreamMetadataFormatClassNames,
061: supportsStandardImageMetadataFormat,
062: nativeImageMetadataFormatName,
063: nativeImageMetadataFormatClassName,
064: extraImageMetadataFormatNames,
065: extraImageMetadataFormatClassNames);
066:
067: if (inputTypes == null || inputTypes.length == 0) {
068: throw new NullPointerException(
069: "input types array cannot be NULL or empty");
070: }
071: this .inputTypes = inputTypes;
072: this .writerSpiNames = writerSpiNames;
073: }
074:
075: public Class[] getInputTypes() {
076: return inputTypes;
077: }
078:
079: public abstract boolean canDecodeInput(Object source)
080: throws IOException;
081:
082: public ImageReader createReaderInstance() throws IOException {
083: return createReaderInstance(null);
084: }
085:
086: public abstract ImageReader createReaderInstance(Object extension)
087: throws IOException;
088:
089: public boolean isOwnReader(ImageReader reader)
090: throws NotImplementedException {
091: // TODO: implement
092: throw new NotImplementedException();
093: }
094:
095: public String[] getImageWriterSpiNames()
096: throws NotImplementedException {
097: // TODO: implement
098: throw new NotImplementedException();
099: }
100: }
|