diff options
Diffstat (limited to 'libjava/javax/imageio')
46 files changed, 0 insertions, 9625 deletions
diff --git a/libjava/javax/imageio/IIOException.java b/libjava/javax/imageio/IIOException.java deleted file mode 100644 index 8f8dd03441c..00000000000 --- a/libjava/javax/imageio/IIOException.java +++ /dev/null @@ -1,69 +0,0 @@ -/* IIOException.java -- - Copyright (C) 2004, 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -package javax.imageio; - -import java.io.IOException; - - -/** - * @author Michael Koch (konqueror@gmx.de) - */ -public class IIOException extends IOException -{ - /** - * Create an exception with a descriptive error message. - * - * @param message The descriptive error message. - */ - public IIOException(String message) - { - super(message); - } - - /** - * Create an exception with a descriptive error message. - * - * @param message The descriptive error message. - * @param cause The cause for this exception. - */ - public IIOException(String message, Throwable cause) - { - super(message); - initCause(cause); - } -} diff --git a/libjava/javax/imageio/IIOImage.java b/libjava/javax/imageio/IIOImage.java deleted file mode 100644 index 651c9baaa21..00000000000 --- a/libjava/javax/imageio/IIOImage.java +++ /dev/null @@ -1,138 +0,0 @@ -/* IIOImage.java -- - Copyright (C) 2003 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio; - -import java.awt.image.BufferedImage; -import java.awt.image.Raster; -import java.awt.image.RenderedImage; -import java.util.List; - -import javax.imageio.metadata.IIOMetadata; - -public class IIOImage -{ - protected RenderedImage image; - protected IIOMetadata metadata; - protected Raster raster; - protected List thumbnails; - - public IIOImage (Raster raster, List thumbnails, IIOMetadata metadata) - { - if (raster == null) - throw new IllegalArgumentException ("raster may not be null"); - - this.raster = raster; - this.thumbnails = thumbnails; - this.metadata = metadata; - } - - public IIOImage (RenderedImage image, List thumbnails, IIOMetadata metadata) - { - if (image == null) - throw new IllegalArgumentException ("image may not be null"); - - this.image = image; - this.thumbnails = thumbnails; - this.metadata = metadata; - } - - public IIOMetadata getMetadata() - { - return metadata; - } - - public int getNumThumbnails() - { - return thumbnails.size(); - } - - public Raster getRaster() - { - return raster; - } - - public RenderedImage getRenderedImage() - { - return image; - } - - public BufferedImage getThumbnail (int index) - { - return (BufferedImage) thumbnails.get (index); - } - - public List getThumbnails() - { - return thumbnails; - } - - public boolean hasRaster() - { - return raster != null; - } - - public void setMetadata (IIOMetadata metadata) - { - this.metadata = metadata; - } - - public void setRaster (Raster raster) - { - if (raster == null) - throw new IllegalArgumentException ("raster may not be null"); - - this.image = null; - this.raster = raster; - } - - public void setRenderedImage (RenderedImage image) - { - if (image == null) - throw new IllegalArgumentException ("image may not be null"); - - this.image = image; - this.raster = null; - } - - public void setThumbnails (List thumbnails) - { - this.thumbnails = thumbnails; - } - -} // class IIOParam diff --git a/libjava/javax/imageio/IIOParam.java b/libjava/javax/imageio/IIOParam.java deleted file mode 100644 index 01f6166059d..00000000000 --- a/libjava/javax/imageio/IIOParam.java +++ /dev/null @@ -1,171 +0,0 @@ -/* IIOParam.java -- - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio; - -import java.awt.Point; -import java.awt.Rectangle; - -/** - * @author Michael Koch (konqueror@gmx.de) - */ -public abstract class IIOParam -{ - protected IIOParamController controller; - protected IIOParamController defaultController; - protected Point destinationOffset = new Point(0, 0); - protected ImageTypeSpecifier destinationType; - protected int[] sourceBands; - protected Rectangle sourceRegion; - protected int sourceXSubsampling; - protected int sourceYSubsampling; - protected int subsamplingXOffset; - protected int subsamplingYOffset; - - /** - * Initializes an <code>IIOParam</code> object. - */ - protected IIOParam() - { - // Do nothing here. - } - - public boolean activateController() - { - if (controller == null) - return false; - - return controller.activate(this); - } - - public IIOParamController getController() - { - return controller; - } - - public IIOParamController getDefaultController() - { - return defaultController; - } - - public Point getDestinationOffset() - { - return destinationOffset; - } - - public ImageTypeSpecifier getDestinationType() - { - return destinationType; - } - - public int[] getSourceBands() - { - return sourceBands; - } - - public Rectangle getSourceRegion() - { - return sourceRegion; - } - - public int getSourceXSubsampling() - { - return sourceXSubsampling; - } - - public int getSourceYSubsampling() - { - return sourceYSubsampling; - } - - public int getSubsamplingXOffset() - { - return subsamplingXOffset; - } - - public int getSubsamplingYOffset() - { - return subsamplingYOffset; - } - - public boolean hasController() - { - return getController() != null; - } - - public void setController(IIOParamController controller) - { - this.controller = controller; - } - - public void setDestinationOffset(Point destinationOffset) - { - if (destinationOffset == null) - throw new IllegalArgumentException("destinationOffset is null"); - - this.destinationOffset = destinationOffset; - } - - public void setSourceBands(int[] sourceBands) - { - this.sourceBands = sourceBands; - } - - public void setSourceRegion(Rectangle sourceRegion) - { - if (sourceRegion != null - && (sourceRegion.x < 0 - || sourceRegion.y < 0 - || sourceRegion.width <= 0 - || sourceRegion.height <= 0)) - throw new IllegalArgumentException("illegal source region"); - - // FIXME: Throw IllegalStateException. - - this.sourceRegion = sourceRegion; - } - - public void setSourceSubsampling(int sourceXSubsampling, int sourceYSubsampling, - int subsamplingXOffset, int subsamplingYOffset) - { - this.sourceXSubsampling = sourceXSubsampling; - this.sourceYSubsampling = sourceYSubsampling; - this.subsamplingXOffset = subsamplingXOffset; - this.subsamplingYOffset = subsamplingYOffset; - } -} diff --git a/libjava/javax/imageio/IIOParamController.java b/libjava/javax/imageio/IIOParamController.java deleted file mode 100644 index 125520e735b..00000000000 --- a/libjava/javax/imageio/IIOParamController.java +++ /dev/null @@ -1,58 +0,0 @@ -/* IIOParamController.java -- - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio; - -/** - * @author Michael Koch (konqueror@gmx.de) - */ -public interface IIOParamController -{ - /** - * Activates the controller. - * - * @param param the <code>IIOParam</code> to be modified - * - * @return true if the <code>IIOParam</code> has been modified, - * false otherwise - * - * @exception IllegalArgumentException if param is null or is not an instance - * of the correct class - */ - boolean activate(IIOParam param); -} diff --git a/libjava/javax/imageio/ImageIO.java b/libjava/javax/imageio/ImageIO.java deleted file mode 100644 index 95c7c325121..00000000000 --- a/libjava/javax/imageio/ImageIO.java +++ /dev/null @@ -1,605 +0,0 @@ -/* ImageIO.java -- - Copyright (C) 2004, 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio; - -import java.awt.image.BufferedImage; -import java.awt.image.RenderedImage; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.URL; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; - -import javax.imageio.spi.IIORegistry; -import javax.imageio.spi.ImageReaderSpi; -import javax.imageio.spi.ImageWriterSpi; -import javax.imageio.spi.ServiceRegistry; -import javax.imageio.stream.ImageInputStream; -import javax.imageio.stream.ImageOutputStream; -import javax.imageio.stream.MemoryCacheImageInputStream; -import javax.imageio.stream.MemoryCacheImageOutputStream; - -public final class ImageIO -{ - /** - * This class isn't intended to be instantiated. - */ - private ImageIO() {} - - private static final class ReaderFormatFilter implements ServiceRegistry.Filter - { - private String formatName; - - public ReaderFormatFilter(String formatName) - { - this.formatName = formatName; - } - - public boolean filter (Object provider) - { - if (provider instanceof ImageReaderSpi) - { - ImageReaderSpi spi = (ImageReaderSpi) provider; - String[] formatNames = spi.getFormatNames(); - - for (int i = formatNames.length - 1; i >= 0; --i) - if (formatName.equals(formatNames[i])) - return true; - } - - return false; - } - } - - private static final class ReaderMIMETypeFilter implements ServiceRegistry.Filter - { - private String MIMEType; - - public ReaderMIMETypeFilter(String MIMEType) - { - this.MIMEType = MIMEType; - } - - public boolean filter(Object provider) - { - if (provider instanceof ImageReaderSpi) - { - ImageReaderSpi spi = (ImageReaderSpi) provider; - String[] mimetypes = spi.getMIMETypes(); - - for (int i = mimetypes.length - 1; i >= 0; --i) - if (MIMEType.equals(mimetypes[i])) - return true; - } - - return false; - } - } - - private static final class ReaderSuffixFilter implements ServiceRegistry.Filter - { - private String fileSuffix; - - public ReaderSuffixFilter(String fileSuffix) - { - this.fileSuffix = fileSuffix; - } - - public boolean filter(Object provider) - { - if (provider instanceof ImageReaderSpi) - { - ImageReaderSpi spi = (ImageReaderSpi) provider; - String[] suffixes = spi.getFileSuffixes(); - - for (int i = suffixes.length - 1; i >= 0; --i) - if (fileSuffix.equals(suffixes[i])) - return true; - } - - return false; - } - } - - private static final class WriterFormatFilter implements ServiceRegistry.Filter - { - private String formatName; - - public WriterFormatFilter(String formatName) - { - this.formatName = formatName; - } - - public boolean filter(Object provider) - { - if (provider instanceof ImageWriterSpi) - { - ImageWriterSpi spi = (ImageWriterSpi) provider; - String[] formatNames = spi.getFormatNames(); - - for (int i = formatNames.length - 1; i >= 0; --i) - if (formatName.equals(formatNames[i])) - return true; - } - - return false; - } - } - - private static final class WriterMIMETypeFilter implements ServiceRegistry.Filter - { - private String MIMEType; - - public WriterMIMETypeFilter(String MIMEType) - { - this.MIMEType = MIMEType; - } - - public boolean filter(Object provider) - { - if (provider instanceof ImageWriterSpi) - { - ImageWriterSpi spi = (ImageWriterSpi) provider; - String[] mimetypes = spi.getMIMETypes(); - - for (int i = mimetypes.length - 1; i >= 0; --i) - if (MIMEType.equals(mimetypes[i])) - return true; - } - - return false; - } - } - - private static final class WriterSuffixFilter implements ServiceRegistry.Filter - { - private String fileSuffix; - - public WriterSuffixFilter(String fileSuffix) - { - this.fileSuffix = fileSuffix; - } - - public boolean filter(Object provider) - { - if (provider instanceof ImageWriterSpi) - { - ImageWriterSpi spi = (ImageWriterSpi) provider; - String[] suffixes = spi.getFileSuffixes(); - - for (int i = suffixes.length - 1; i >= 0; --i) - if (fileSuffix.equals(suffixes[i])) - return true; - } - - return false; - } - } - - private static final class ImageReaderIterator implements Iterator - { - Iterator it; - Object readerExtension; - - public ImageReaderIterator(Iterator it, Object readerExtension) - { - this.it = it; - this.readerExtension = readerExtension; - } - - public boolean hasNext() - { - return it.hasNext(); - } - - public Object next() - { - try - { - return ((ImageReaderSpi) it.next()).createReaderInstance(readerExtension); - } - catch (IOException e) - { - return null; - } - } - - public void remove() - { - throw new UnsupportedOperationException(); - } - } - - private static final class ImageWriterIterator implements Iterator - { - Iterator it; - Object writerExtension; - - public ImageWriterIterator(Iterator it, Object writerExtension) - { - this.it = it; - this.writerExtension = writerExtension; - } - - public boolean hasNext() - { - return it.hasNext(); - } - - public Object next() - { - try - { - return ((ImageWriterSpi) it.next()).createWriterInstance(writerExtension); - } - catch (IOException e) - { - return null; - } - } - - public void remove() - { - throw new UnsupportedOperationException(); - } - } - - private static File cacheDirectory; - private static boolean useCache = true; - - private static Iterator getReadersByFilter(Class type, - ServiceRegistry.Filter filter, - Object readerExtension) - { - try - { - Iterator it = getRegistry().getServiceProviders(type, filter, true); - return new ImageReaderIterator(it, readerExtension); - } - catch (IllegalArgumentException e) - { - return Collections.EMPTY_SET.iterator(); - } - } - - private static Iterator getWritersByFilter(Class type, - ServiceRegistry.Filter filter, - Object writerExtension) - { - try - { - Iterator it = getRegistry().getServiceProviders(type, filter, true); - return new ImageWriterIterator(it, writerExtension); - } - catch (IllegalArgumentException e) - { - return Collections.EMPTY_SET.iterator(); - } - } - - public static File getCacheDirectory() - { - return cacheDirectory; - } - - public static Iterator getImageReadersByFormatName(String formatName) - { - if (formatName == null) - throw new IllegalArgumentException("formatName may not be null"); - - return getReadersByFilter(ImageReaderSpi.class, - new ReaderFormatFilter(formatName), - formatName); - } - - public static Iterator getImageReadersByMIMEType(String MIMEType) - { - if (MIMEType == null) - throw new IllegalArgumentException("MIMEType may not be null"); - - return getReadersByFilter(ImageReaderSpi.class, - new ReaderMIMETypeFilter(MIMEType), - MIMEType); - } - - public static Iterator getImageReadersBySuffix(String fileSuffix) - { - if (fileSuffix == null) - throw new IllegalArgumentException("formatName may not be null"); - - return getReadersByFilter(ImageReaderSpi.class, - new ReaderSuffixFilter(fileSuffix), - fileSuffix); - } - - public static Iterator getImageWritersByFormatName(String formatName) - { - if (formatName == null) - throw new IllegalArgumentException("formatName may not be null"); - - return getWritersByFilter(ImageWriterSpi.class, - new WriterFormatFilter(formatName), - formatName); - } - - public static Iterator getImageWritersByMIMEType(String MIMEType) - { - if (MIMEType == null) - throw new IllegalArgumentException("MIMEType may not be null"); - - return getWritersByFilter(ImageWriterSpi.class, - new WriterMIMETypeFilter(MIMEType), - MIMEType); - } - - public static Iterator getImageWritersBySuffix(String fileSuffix) - { - if (fileSuffix == null) - throw new IllegalArgumentException("fileSuffix may not be null"); - - return getWritersByFilter(ImageWriterSpi.class, - new WriterSuffixFilter(fileSuffix), - fileSuffix); - } - - public static String[] getReaderFormatNames() - { - try - { - Iterator it = - getRegistry().getServiceProviders(ImageReaderSpi.class, true); - ArrayList result = new ArrayList(); - - while (it.hasNext()) - { - ImageReaderSpi spi = (ImageReaderSpi) it.next(); - String[] names = spi.getFormatNames(); - - for (int i = names.length - 1; i >= 0; --i) - result.add(names[i]); - } - - return (String[]) result.toArray(new String[result.size()]); - } - catch (IllegalArgumentException e) - { - return new String[0]; - } - } - - public static String[] getReaderMIMETypes() - { - try - { - Iterator it = - getRegistry().getServiceProviders(ImageReaderSpi.class, true); - ArrayList result = new ArrayList(); - - while (it.hasNext()) - { - ImageReaderSpi spi = (ImageReaderSpi) it.next(); - String[] names = spi.getMIMETypes(); - - for (int i = names.length - 1; i >= 0; --i) - result.add(names[i]); - } - - return (String[]) result.toArray(new String[result.size()]); - } - catch (IllegalArgumentException e) - { - return new String[0]; - } - } - - private static IIORegistry getRegistry() - { - return IIORegistry.getDefaultInstance(); - } - - public static boolean getUseCache() - { - return useCache; - } - - public static String[] getWriterFormatNames() - { - try - { - Iterator it = - getRegistry().getServiceProviders(ImageWriterSpi.class, true); - ArrayList result = new ArrayList(); - - while (it.hasNext()) - { - ImageWriterSpi spi = (ImageWriterSpi) it.next(); - String[] names = spi.getFormatNames(); - - for (int i = names.length - 1; i >= 0; --i) - result.add(names[i]); - } - - return (String[]) result.toArray(new String[result.size()]); - } - catch (IllegalArgumentException e) - { - return new String[0]; - } - } - - public static String[] getWriterMIMETypes() - { - try - { - Iterator it = - getRegistry().getServiceProviders(ImageWriterSpi.class, true); - ArrayList result = new ArrayList(); - - while (it.hasNext()) - { - ImageWriterSpi spi = (ImageWriterSpi) it.next(); - String[] names = spi.getMIMETypes(); - - for (int i = names.length - 1; i >= 0; --i) - result.add(names[i]); - } - - return (String[]) result.toArray(new String[result.size()]); - } - catch (IllegalArgumentException e) - { - return new String[0]; - } - } - - /** - * Rescans the application classpath for ImageIO service providers - * and registers them. - */ - public static void scanForPlugins() - { - IIORegistry.getDefaultInstance().registerApplicationClasspathSpis(); - } - - public static void setCacheDirectory(File cacheDirectory) - { - if (cacheDirectory != null) - { - if (!cacheDirectory.isDirectory()) - throw new IllegalArgumentException("cacheDirectory must be a directory"); - - cacheDirectory.canWrite(); - } - - ImageIO.cacheDirectory = cacheDirectory; - } - - public static void setUseCache(boolean useCache) - { - ImageIO.useCache = useCache; - } - - /* - * "Standard" simplified entry points. - */ - - public static boolean write(RenderedImage im, - String formatName, - File output) - throws IOException - { - return write(im, formatName, new FileOutputStream(output)); - } - - public static boolean write(RenderedImage im, - String formatName, - OutputStream output) - throws IOException - { - return write(im, formatName, new MemoryCacheImageOutputStream(output)); - } - - - public static boolean write(RenderedImage im, - String formatName, - ImageOutputStream output) - throws IOException - { - Iterator writers = getImageWritersByFormatName(formatName); - IIOImage img = new IIOImage(im, null, null); - while (writers.hasNext()) - { - ImageWriter w = (ImageWriter) writers.next(); - try - { - w.setOutput(output); - } - catch (IllegalArgumentException e) - { - continue; - } - - w.write(null, img, null); - output.close(); - return true; - } - return false; - } - - public static BufferedImage read(ImageInputStream stream) - throws IOException - { - Iterator providers = getRegistry().getServiceProviders(ImageReaderSpi.class, true); - while (providers.hasNext()) - { - ImageReaderSpi spi = (ImageReaderSpi) providers.next(); - if (spi.canDecodeInput(stream)) - { - ImageReader reader = spi.createReaderInstance(); - reader.setInput(stream); - return reader.read(0, null); - } - } - return null; - } - - public static BufferedImage read(URL input) - throws IOException - { - return read(input.openStream()); - } - - public static BufferedImage read(InputStream input) - throws IOException - { - return read(new MemoryCacheImageInputStream(input)); - } - - public static BufferedImage read(File input) - throws IOException - { - return read(new FileInputStream(input)); - } - -} diff --git a/libjava/javax/imageio/ImageReadParam.java b/libjava/javax/imageio/ImageReadParam.java deleted file mode 100644 index 889fe6cc97d..00000000000 --- a/libjava/javax/imageio/ImageReadParam.java +++ /dev/null @@ -1,126 +0,0 @@ -/* ImageReadParam.java -- - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio; - -import java.awt.Dimension; -import java.awt.image.BufferedImage; - -/** - * @author Michel Koch (konqueror@gmx.de) - */ -public class ImageReadParam extends IIOParam -{ - protected boolean canSetSourceRenderSize; - protected BufferedImage destination; - protected int[] destinationBands; - protected int minProgressivePass; - protected int numProgressivePasses = Integer.MAX_VALUE; - protected Dimension sourceRenderSize; - - public ImageReadParam() - { - } - - public boolean canSetSourceRenderSize() - { - return canSetSourceRenderSize; - } - - public BufferedImage getDestination() - { - return destination; - } - - public int[] getDestinationBands() - { - return destinationBands; - } - - public int getSourceMaxProgressivePass() - { - if (getSourceNumProgressivePasses() == Integer.MAX_VALUE) - return Integer.MAX_VALUE; - - return getSourceMinProgressivePass() + getSourceNumProgressivePasses() - 1; - } - - public int getSourceMinProgressivePass() - { - return minProgressivePass; - } - - public int getSourceNumProgressivePasses() - { - return numProgressivePasses; - } - - public Dimension getSourceRenderSize() - { - return sourceRenderSize; - } - - public void setDestination(BufferedImage destination) - { - this.destination = destination; - } - - public void setDestinationBands(int[] destinationBands) - { - this.destinationBands = destinationBands; - } - - public void setSourceProgressivePasses(int minPass, int numPasses) - { - this.minProgressivePass = minPass; - this.numProgressivePasses = numPasses; - } - - public void setSourceRenderSize(Dimension size) - throws UnsupportedOperationException - { - if (! canSetSourceRenderSize()) - throw new UnsupportedOperationException - ("setting source render size not supported"); - - if (size.width <= 0 || size.height <= 0) - throw new IllegalArgumentException("negative dimension not allowed"); - - sourceRenderSize = size; - } -} diff --git a/libjava/javax/imageio/ImageReader.java b/libjava/javax/imageio/ImageReader.java deleted file mode 100644 index fdf692bd2aa..00000000000 --- a/libjava/javax/imageio/ImageReader.java +++ /dev/null @@ -1,556 +0,0 @@ -/* ImageReader.java -- Decodes raster images. - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio; - -import java.awt.image.BufferedImage; -import java.awt.image.Raster; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Locale; - -import javax.imageio.event.IIOReadProgressListener; -import javax.imageio.event.IIOReadUpdateListener; -import javax.imageio.event.IIOReadWarningListener; -import javax.imageio.metadata.IIOMetadata; -import javax.imageio.spi.ImageReaderSpi; -import javax.imageio.stream.ImageInputStream; - -public abstract class ImageReader -{ - private boolean aborted; - - protected Locale[] availableLocales; - protected boolean ignoreMetadata; - protected Object input; - protected Locale locale; - protected int minIndex; - protected ImageReaderSpi originatingProvider; - protected List progressListeners = new ArrayList(); - protected boolean seekForwardOnly; - protected List updateListeners = new ArrayList(); - protected List warningListeners = new ArrayList(); - protected List warningLocales = new ArrayList(); - - protected ImageReader(ImageReaderSpi originatingProvider) - { - this.originatingProvider = originatingProvider; - } - - public void abort() - { - aborted = true; - } - - protected boolean abortRequested() - { - return aborted; - } - - public void addIIOReadProgressListener(IIOReadProgressListener listener) - { - if (listener == null) - return; - - progressListeners.add(listener); - } - - public void addIIOReadUpdateListener(IIOReadUpdateListener listener) - { - if (listener == null) - return; - - updateListeners.add(listener); - } - - public void addIIOReadWarningListener(IIOReadWarningListener listener) - { - if (listener == null) - return; - - warningListeners.add(listener); - } - - public boolean canReadRaster() - { - return false; - } - - protected void clearAbortRequest() - { - aborted = false; - } - - public void dispose() - { - // The default implementation does nothing. - } - - public float getAspectRatio(int imageIndex) - throws IOException - { - return (float) (getWidth(imageIndex) / getHeight(imageIndex)); - } - - public Locale[] getAvailableLocales() - { - if (availableLocales == null) - return null; - - return (Locale[]) availableLocales.clone(); - } - - public ImageReadParam getDefaultReadParam() - { - return new ImageReadParam(); - } - - public String getFormatName() - throws IOException - { - return originatingProvider.getFormatNames()[0]; - } - - public abstract int getHeight(int imageIndex) - throws IOException; - - public abstract IIOMetadata getImageMetadata(int imageIndex) - throws IOException; - - public abstract Iterator getImageTypes(int imageIndex) - throws IOException; - - public void setInput(Object input, - boolean seekForwardOnly, - boolean ignoreMetadata) - { - Class[] okClasses = originatingProvider.getInputTypes(); - if (okClasses == null) - { - if (!(input instanceof ImageInputStream)) - throw new IllegalArgumentException(); - } - else - { - boolean classOk = false; - for (int i = 0; i < okClasses.length; ++i) - if (okClasses[i].isInstance(input)) - classOk = true; - if (!classOk) - throw new IllegalArgumentException(); - } - - this.input = input; - this.seekForwardOnly = seekForwardOnly; - this.ignoreMetadata = ignoreMetadata; - this.minIndex = 0; - } - - public void setInput(Object in, boolean seekForwardOnly) - { - setInput(in, seekForwardOnly, false); - } - - public void setInput(Object in) - { - setInput(in, false, false); - } - - public Object getInput() - { - return input; - } - - public Locale getLocale() - { - return locale; - } - - public abstract int getNumImages(boolean allowSearch) - throws IOException; - - public int getNumThumbnails(int imageIndex) - throws IOException - { - return 0; - } - - public ImageReaderSpi getOriginatingProvider() - { - return originatingProvider; - } - - public abstract IIOMetadata getStreamMetadata() - throws IOException; - - public int getThumbnailHeight(int imageIndex, int thumbnailIndex) - throws IOException - { - return readThumbnail(imageIndex, thumbnailIndex).getHeight(); - } - - public int getThumbnailWidth(int imageIndex, int thumbnailIndex) - throws IOException - { - return readThumbnail(imageIndex, thumbnailIndex).getWidth(); - } - - public int getTileGridXOffset(int imageIndex) - throws IOException - { - return 0; - } - - public int getTileGridYOffset(int imageIndex) - throws IOException - { - return 0; - } - - public int getTileHeight(int imageIndex) - throws IOException - { - return getHeight(imageIndex); - } - - public int getTileWidth(int imageIndex) - throws IOException - { - return getWidth(imageIndex); - } - - public abstract int getWidth(int imageIndex) - throws IOException; - - public boolean hasThumbnails(int imageIndex) - throws IOException - { - return getNumThumbnails(imageIndex) > 0; - } - - public boolean isIgnoringMetadata() - { - return ignoreMetadata; - } - - public boolean isImageTiled(int imageIndex) - throws IOException - { - return false; - } - - public boolean isRandomAccessEasy(int imageIndex) - throws IOException - { - return false; - } - - public boolean isSeekForwardOnly() - { - return seekForwardOnly; - } - - protected void processImageComplete() - { - Iterator it = progressListeners.iterator(); - - while (it.hasNext()) - { - IIOReadProgressListener listener = (IIOReadProgressListener) it.next(); - listener.imageComplete (this); - } - } - - protected void processImageProgress(float percentageDone) - { - Iterator it = progressListeners.iterator(); - - while (it.hasNext()) - { - IIOReadProgressListener listener = (IIOReadProgressListener) it.next(); - listener.imageProgress(this, percentageDone); - } - } - - protected void processImageStarted(int imageIndex) - { - Iterator it = progressListeners.iterator(); - - while (it.hasNext()) - { - IIOReadProgressListener listener = (IIOReadProgressListener) it.next(); - listener.imageStarted(this, imageIndex); - } - } - - protected void processImageUpdate(BufferedImage image, int minX, int minY, - int width, int height, int periodX, - int periodY, int[] bands) - { - Iterator it = updateListeners.iterator(); - - while (it.hasNext()) - { - IIOReadUpdateListener listener = (IIOReadUpdateListener) it.next(); - listener.imageUpdate(this, image, minX, minY, width, height, periodX, - periodY, bands); - } - } - - protected void processPassComplete(BufferedImage image) - { - Iterator it = updateListeners.iterator(); - - while (it.hasNext()) - { - IIOReadUpdateListener listener = (IIOReadUpdateListener) it.next(); - listener.passComplete(this, image); - } - } - - protected void processPassStarted(BufferedImage image, int pass, int minPass, - int maxPass, int minX, int minY, - int periodX, int periodY, int[] bands) - { - Iterator it = updateListeners.iterator(); - - while (it.hasNext()) - { - IIOReadUpdateListener listener = (IIOReadUpdateListener) it.next(); - listener.passStarted(this, image, pass, minPass, maxPass, minX, minY, - periodX, periodY, bands); - } - } - - protected void processReadAborted() - { - Iterator it = progressListeners.iterator(); - - while (it.hasNext()) - { - IIOReadProgressListener listener = (IIOReadProgressListener) it.next(); - listener.readAborted(this); - } - } - - protected void processSequenceComplete() - { - Iterator it = progressListeners.iterator(); - - while (it.hasNext()) - { - IIOReadProgressListener listener = (IIOReadProgressListener) it.next(); - listener.sequenceComplete(this); - } - } - - protected void processSequenceStarted(int minIndex) - { - Iterator it = progressListeners.iterator(); - - while (it.hasNext()) - { - IIOReadProgressListener listener = (IIOReadProgressListener) it.next(); - listener.sequenceStarted(this, minIndex); - } - } - - protected void processThumbnailComplete() - { - Iterator it = progressListeners.iterator(); - - while (it.hasNext()) - { - IIOReadProgressListener listener = (IIOReadProgressListener) it.next(); - listener.thumbnailComplete(this); - } - } - - protected void processThumbnailPassComplete(BufferedImage thumbnail) - { - Iterator it = updateListeners.iterator(); - - while (it.hasNext()) - { - IIOReadUpdateListener listener = (IIOReadUpdateListener) it.next(); - listener.thumbnailPassComplete(this, thumbnail); - } - } - - protected void processThumbnailPassStarted(BufferedImage thumbnail, int pass, - int minPass, int maxPass, int minX, - int minY, int periodX, int periodY, - int[] bands) - { - Iterator it = updateListeners.iterator(); - - while (it.hasNext()) - { - IIOReadUpdateListener listener = (IIOReadUpdateListener) it.next(); - listener.thumbnailPassStarted(this, thumbnail, pass, minPass, maxPass, - minX, minY, periodX, periodY, bands); - } - } - - protected void processThumbnailProgress(float percentageDone) - { - Iterator it = progressListeners.iterator(); - - while (it.hasNext()) - { - IIOReadProgressListener listener = (IIOReadProgressListener) it.next(); - listener.thumbnailProgress(this, percentageDone); - } - } - - protected void processThumbnailStarted(int imageIndex, int thumbnailIndex) - { - Iterator it = progressListeners.iterator(); - - while (it.hasNext()) - { - IIOReadProgressListener listener = (IIOReadProgressListener) it.next(); - listener.thumbnailStarted(this, imageIndex, thumbnailIndex); - } - } - - protected void processThumbnailUpdate(BufferedImage image, int minX, int minY, - int width, int height, int periodX, - int periodY, int[] bands) - { - Iterator it = updateListeners.iterator(); - - while (it.hasNext()) - { - IIOReadUpdateListener listener = (IIOReadUpdateListener) it.next(); - listener.thumbnailUpdate(this, image, minX, minY, width, height, - periodX, periodY, bands); - } - } - - protected void processWarningOccurred(String warning) - { - Iterator it = warningListeners.iterator(); - - while (it.hasNext()) - { - IIOReadWarningListener listener = (IIOReadWarningListener) it.next(); - listener.warningOccurred(this, warning); - } - } - - public abstract BufferedImage read(int imageIndex, ImageReadParam param) - throws IOException; - - public boolean readerSupportsThumbnails() - { - return false; - } - - public Raster readRaster(int imageIndex, ImageReadParam param) - throws IOException - { - throw new UnsupportedOperationException(); - } - - public BufferedImage readThumbnail(int imageIndex, int thumbnailIndex) - throws IOException - { - throw new UnsupportedOperationException(); - } - - public void removeAllIIOReadProgressListeners() - { - progressListeners.clear(); - } - - public void removeAllIIOReadUpdateListeners() - { - updateListeners.clear(); - } - - public void removeAllIIOReadWarningListeners() - { - warningListeners.clear(); - } - - public void removeIIOReadProgressListener(IIOReadProgressListener listener) - { - if (listener == null) - return; - - progressListeners.remove(listener); - } - - public void removeIIOReadUpdateListener(IIOReadUpdateListener listener) - { - if (listener == null) - return; - - updateListeners.remove(listener); - } - - public void removeIIOReadWarningListener(IIOReadWarningListener listener) - { - if (listener == null) - return; - - warningListeners.remove(listener); - } - - public void setLocale(Locale locale) - { - if (locale != null) - { - // Check if its a valid locale. - boolean found = false; - - if (availableLocales != null) - for (int i = availableLocales.length - 1; i >= 0; --i) - if (availableLocales[i].equals(locale)) - found = true; - - if (! found) - throw new IllegalArgumentException("looale not available"); - } - - this.locale = locale; - } -} diff --git a/libjava/javax/imageio/ImageTranscoder.java b/libjava/javax/imageio/ImageTranscoder.java deleted file mode 100644 index ccc99316269..00000000000 --- a/libjava/javax/imageio/ImageTranscoder.java +++ /dev/null @@ -1,54 +0,0 @@ -/* ImageTranscoder.java -- Image metadata transcoder. - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio; - -import javax.imageio.metadata.IIOMetadata; - -/** - * @author Michael Koch (konqueror@gmx.de) - */ -public interface ImageTranscoder -{ - IIOMetadata convertImageMetadata(IIOMetadata inData, - ImageTypeSpecifier imageType, - ImageWriteParam param); - - IIOMetadata convertStreamMetadata(IIOMetadata inData, - ImageWriteParam param); -} diff --git a/libjava/javax/imageio/ImageTypeSpecifier.java b/libjava/javax/imageio/ImageTypeSpecifier.java deleted file mode 100644 index 0751e376757..00000000000 --- a/libjava/javax/imageio/ImageTypeSpecifier.java +++ /dev/null @@ -1,94 +0,0 @@ -/* ImageTypeSpecifier.java -- - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio; - -import java.awt.image.ColorModel; -import java.awt.image.RenderedImage; -import java.awt.image.SampleModel; - -public class ImageTypeSpecifier -{ - protected ColorModel colorModel; - protected SampleModel sampleModel; - - public ImageTypeSpecifier(ColorModel colorModel, SampleModel sampleModel) - { - if (colorModel == null) - throw new IllegalArgumentException("colorModel may not be null"); - - if (sampleModel == null) - throw new IllegalArgumentException("sampleModel may not be null"); - - if (!colorModel.isCompatibleSampleModel(sampleModel)) - throw new IllegalArgumentException - ("sample Model not compatible with colorModel"); - - this.colorModel = colorModel; - this.sampleModel = sampleModel; - } - - public ImageTypeSpecifier(RenderedImage image) - { - if (image == null) - throw new IllegalArgumentException("image may not be null"); - - this.colorModel = image.getColorModel(); - this.sampleModel = image.getSampleModel(); - } - - public ColorModel getColorModel() - { - return colorModel; - } - - public int getNumBands() - { - return sampleModel.getNumBands(); - } - - public int getNumComponents() - { - return colorModel.getNumComponents(); - } - - public SampleModel getSampleModel() - { - return sampleModel; - } -} diff --git a/libjava/javax/imageio/ImageWriteParam.java b/libjava/javax/imageio/ImageWriteParam.java deleted file mode 100644 index 08f4885a8d1..00000000000 --- a/libjava/javax/imageio/ImageWriteParam.java +++ /dev/null @@ -1,398 +0,0 @@ -/* ImageWriteParam.java -- - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio; - -import java.awt.Dimension; -import java.util.Locale; - -public class ImageWriteParam extends IIOParam -{ - public static final int MODE_DISABLED = 0; - public static final int MODE_DEFAULT = 1; - public static final int MODE_EXPLICIT = 2; - public static final int MODE_COPY_FROM_METADATA = 3; - - protected boolean canOffsetTiles; - protected boolean canWriteCompressed; - protected boolean canWriteProgressive; - protected boolean canWriteTiles; - protected int compressionMode = MODE_COPY_FROM_METADATA; - protected float compressionQuality; - protected String compressionType; - protected String[] compressionTypes; - protected Locale locale; - protected Dimension[] preferredTileSizes; - protected int progressiveMode = MODE_COPY_FROM_METADATA; - protected int tileGridXOffset; - protected int tileGridYOffset; - protected int tileHeight; - protected int tileWidth; - protected int tilingMode; - protected boolean tilingSet; - - /** - * Creates an empty <code>ImageWriteParam</code> object. - * The subclass is responsible to initialize all fields. - */ - protected ImageWriteParam() - { - // Do nothing here. - } - - /** - * Creates an <code>ImageWriteParam</code> object with the given locale. - * - * @param locale the locale to use for user visible strings - */ - public ImageWriteParam(Locale locale) - { - this.locale = locale; - } - - public float getBitRate(float quality) - { - checkNotExplicitCompression(); - checkCompressionTypesSet(); - - return -1.0f; - } - - private void checkSupportsCompression() - { - if (! canWriteCompressed()) - throw new UnsupportedOperationException("compression not supported"); - } - - private void checkNotExplicitCompression() - { - if (getCompressionMode() != MODE_EXPLICIT) - throw new IllegalStateException("compression mode is not MODE_EXPLICIT"); - } - - private void checkCompressionTypesSet() - { - if (getCompressionType() == null - && getCompressionTypes() != null) - throw new IllegalStateException("no compression type set"); - } - - private void checkSupportsProgressiveEncoding() - { - if (! canWriteProgressive()) - throw new UnsupportedOperationException - ("progressive output not supported"); - } - - private void checkSupportsTiling() - { - if (! canWriteTiles()) - throw new UnsupportedOperationException("tiling not supported"); - } - - private void checkNotExplicitTiling() - { - if (getTilingMode() != MODE_EXPLICIT) - throw new IllegalStateException("tiling mode not MODE_EXPLICIT"); - } - - private void checkTilingInitialized() - { - if (! tilingSet) - throw new IllegalStateException("tiling parameters not set"); - } - - private void checkMode(int mode) - { - if (mode < MODE_DISABLED || mode > MODE_COPY_FROM_METADATA) - throw new IllegalArgumentException("mode not supported"); - } - - public boolean canOffsetTiles() - { - return canOffsetTiles; - } - - public boolean canWriteCompressed() - { - return canWriteCompressed; - } - - public boolean canWriteProgressive() - { - return canWriteProgressive; - } - - public boolean canWriteTiles() - { - return canWriteTiles; - } - - public int getCompressionMode() - { - checkSupportsCompression(); - - return compressionMode; - } - - public float getCompressionQuality() - { - checkNotExplicitCompression(); - checkCompressionTypesSet(); - - return compressionQuality; - } - - public String[] getCompressionQualityDescriptions() - { - checkNotExplicitCompression(); - checkCompressionTypesSet();; - - return null; - } - - public float[] getCompressionQualityValues() - { - checkNotExplicitCompression(); - checkCompressionTypesSet();; - - return null; - } - - public String getCompressionType() - { - checkNotExplicitCompression(); - - return compressionType; - } - - public String[] getCompressionTypes() - { - checkSupportsCompression(); - - return compressionTypes != null ? (String[]) compressionTypes.clone() : null; - } - - public Locale getLocale() - { - return locale; - } - - public String getLocalizedCompressionTypeName() - { - checkNotExplicitCompression(); - checkCompressionTypesSet(); - - return getCompressionType(); - } - - public Dimension[] getPreferredTileSizes() - { - checkSupportsTiling(); - - return preferredTileSizes; - } - - public int getProgressiveMode() - { - checkSupportsProgressiveEncoding(); - - return progressiveMode; - } - - public int getTileGridXOffset() - { - checkNotExplicitTiling(); - checkTilingInitialized(); - - return tileGridXOffset; - } - - public int getTileGridYOffset() - { - checkNotExplicitTiling(); - checkTilingInitialized(); - - return tileGridYOffset; - } - - public int getTileHeight() - { - checkNotExplicitTiling(); - checkTilingInitialized(); - - return tileHeight; - } - - public int getTileWidth() - { - checkNotExplicitTiling(); - checkTilingInitialized(); - - return tileWidth; - } - - public int getTilingMode() - { - checkSupportsTiling(); - - return tilingMode; - } - - public boolean isCompressionLossless() - { - checkNotExplicitCompression(); - checkCompressionTypesSet(); - - return true; - } - - public void setCompressionMode(int mode) - { - checkSupportsCompression(); - checkMode(mode); - - compressionMode = mode; - - if (mode == MODE_EXPLICIT) - unsetCompression(); - } - - public void setCompressionQuality(float quality) - { - checkNotExplicitCompression(); - checkCompressionTypesSet(); - - if (quality < 0.0f || quality > 1.0f) - throw new IllegalArgumentException("quality out of range"); - - compressionQuality = quality; - } - - public void setCompressionType(String compressionType) - { - checkNotExplicitCompression(); - - String[] types = getCompressionTypes(); - - if (types == null) - throw new UnsupportedOperationException("no settable compression types"); - - if (compressionType == null) - this.compressionType = null; - - for (int i = types.length - 1; i >= 0; --i) - if (types[i].equals(compressionType)) - { - this.compressionType = compressionType; - return; - } - - throw new IllegalArgumentException("unknown compression type"); - } - - public void setProgressiveMode(int mode) - { - checkSupportsProgressiveEncoding(); - checkMode(mode); - - progressiveMode = mode; - } - - public void setTiling(int tileWidth, int tileHeight, - int tileGridXOffset, int tileGridYOffset) - { - checkNotExplicitTiling(); - - if (! canOffsetTiles - && tileGridXOffset != 0 - && tileGridYOffset != 0) - throw new UnsupportedOperationException("tile offsets not supported"); - - if (tileWidth < 0 || tileHeight < 0) - throw new IllegalArgumentException("negative tile dimension"); - - if (preferredTileSizes != null) - { - boolean found = false; - - for (int i = 0; i < preferredTileSizes.length; i += 2) - { - if (tileWidth >= preferredTileSizes[i].width - && tileWidth <= preferredTileSizes[i + 1].width - && tileHeight >= preferredTileSizes[i].height - && tileHeight <= preferredTileSizes[i + 1].height) - found = true; - } - - if (! found) - throw new IllegalArgumentException("illegal tile size"); - } - - this.tilingSet = true; - this.tileWidth = tileWidth; - this.tileHeight = tileHeight; - this.tileGridXOffset = tileGridXOffset; - this.tileGridYOffset = tileGridYOffset; - } - - public void setTilingMode(int mode) - { - checkSupportsTiling(); - checkMode(mode); - tilingMode = mode; - } - - public void unsetCompression() - { - checkNotExplicitCompression(); - - compressionType = null; - compressionQuality = 1.0F; - } - - public void unsetTiling() - { - checkNotExplicitTiling(); - - tileWidth = 0; - tileHeight = 0; - tileGridXOffset = 0; - tileGridYOffset = 0; - } -} diff --git a/libjava/javax/imageio/ImageWriter.java b/libjava/javax/imageio/ImageWriter.java deleted file mode 100644 index 7479c3074f7..00000000000 --- a/libjava/javax/imageio/ImageWriter.java +++ /dev/null @@ -1,390 +0,0 @@ -/* ImageWriter.java -- Encodes raster images. - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio; - -import java.awt.Dimension; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Locale; - -import javax.imageio.event.IIOWriteProgressListener; -import javax.imageio.event.IIOWriteWarningListener; -import javax.imageio.metadata.IIOMetadata; - -import javax.imageio.spi.ImageWriterSpi; - -public abstract class ImageWriter - implements ImageTranscoder -{ - private boolean aborted; - - protected Locale[] availableLocales; - protected Locale locale; - protected ImageWriterSpi originatingProvider; - protected Object output; - protected List progressListeners = new ArrayList(); - protected List warningListeners = new ArrayList(); - protected List warningLocales = new ArrayList(); - - protected ImageWriter(ImageWriterSpi originatingProvider) - { - this.originatingProvider = originatingProvider; - } - - private void checkOutputSet() - { - if (output == null) - throw new IllegalStateException("no output set"); - } - - public void abort() - { - aborted = true; - } - - protected boolean abortRequested() - { - return aborted; - } - - public void addIIOWriteProgressListener(IIOWriteProgressListener listener) - { - if (listener == null) - return; - - progressListeners.add(listener); - } - - public void addIIOWriteWarningListener (IIOWriteWarningListener listener) - { - if (listener == null) - return; - - warningListeners.add(listener); - } - - public boolean canInsertEmpty(int imageIndex) - throws IOException - { - checkOutputSet(); - return false; - } - - public boolean canInsertImage(int imageIndex) - throws IOException - { - checkOutputSet(); - return false; - } - - public boolean canRemoveImage(int imageIndex) - throws IOException - { - checkOutputSet(); - return false; - } - - public boolean canReplaceImageMetadata(int imageIndex) - throws IOException - { - checkOutputSet(); - return false; - } - - public boolean canReplacePixels(int imageIndex) - throws IOException - { - checkOutputSet(); - return false; - } - - public boolean canReplaceStreamMetadata() - throws IOException - { - checkOutputSet(); - return false; - } - - public boolean canWriteEmpty() - throws IOException - { - checkOutputSet(); - return false; - } - - public boolean canWriteRasters() - { - return false; - } - - public boolean canWriteSequence() - { - return false; - } - - protected void clearAbortRequest() - { - aborted = false; - } - - public abstract IIOMetadata convertImageMetadata (IIOMetadata inData, - ImageTypeSpecifier imageType, - ImageWriteParam param); - - public abstract IIOMetadata convertStreamMetadata (IIOMetadata inData, - ImageWriteParam param); - - public void dispose() - { - // The default implementation is empty. Subclasses have to overwrite it. - } - - public Locale[] getAvailableLocales() - { - return availableLocales; - } - - public abstract IIOMetadata getDefaultImageMetadata (ImageTypeSpecifier imageType, ImageWriteParam param); - - public abstract IIOMetadata getDefaultStreamMetadata (ImageWriteParam param); - - public ImageWriteParam getDefaultWriteParam() - { - return new ImageWriteParam(getLocale()); - } - - public Locale getLocale() - { - return locale; - } - - public int getNumThumbnailsSupported (ImageTypeSpecifier imageType, ImageWriteParam param, - IIOMetadata streamMetadata, IIOMetadata imageMetadata) - { - return 0; - } - - public ImageWriterSpi getOriginatingProvider() - { - return originatingProvider; - } - - public Object getOutput() - { - return output; - } - - public Dimension[] getPreferredThumbnailSizes (ImageTypeSpecifier imageType, - ImageWriteParam param, - IIOMetadata streamMetadata, - IIOMetadata imageMetadata) - { - return null; - } - - protected void processImageComplete() - { - Iterator it = progressListeners.iterator(); - - while (it.hasNext()) - { - IIOWriteProgressListener listener = (IIOWriteProgressListener) it.next(); - listener.imageComplete(this); - } - } - - protected void processImageProgress(float percentageDone) - { - Iterator it = progressListeners.iterator(); - - while (it.hasNext()) - { - IIOWriteProgressListener listener = (IIOWriteProgressListener) it.next(); - listener.imageProgress(this, percentageDone); - } - } - - protected void processImageStarted(int imageIndex) - { - Iterator it = progressListeners.iterator(); - - while (it.hasNext()) - { - IIOWriteProgressListener listener = (IIOWriteProgressListener) it.next(); - listener.imageStarted(this, imageIndex); - } - } - - protected void processThumbnailComplete() - { - Iterator it = progressListeners.iterator(); - - while (it.hasNext()) - { - IIOWriteProgressListener listener = (IIOWriteProgressListener) it.next(); - listener.thumbnailComplete(this); - } - } - - protected void processThumbnailProgress(float percentageDone) - { - Iterator it = progressListeners.iterator(); - - while (it.hasNext()) - { - IIOWriteProgressListener listener = (IIOWriteProgressListener) it.next(); - listener.thumbnailProgress(this, percentageDone); - } - } - - protected void processThumbnailStarted(int imageIndex, int thumbnailIndex) - { - Iterator it = progressListeners.iterator(); - - while (it.hasNext()) - { - IIOWriteProgressListener listener = (IIOWriteProgressListener) it.next(); - listener.thumbnailStarted(this, imageIndex, thumbnailIndex); - } - } - - protected void processWarningOccurred(int imageIndex, String warning) - { - Iterator it = warningListeners.iterator(); - - while (it.hasNext()) - { - IIOWriteWarningListener listener = (IIOWriteWarningListener) it.next(); - listener.warningOccurred(this, imageIndex, warning); - } - } - - protected void processWriteAborted() - { - Iterator it = progressListeners.iterator(); - - while (it.hasNext()) - { - IIOWriteProgressListener listener = (IIOWriteProgressListener) it.next(); - listener.writeAborted(this); - } - } - - public void removeAllIIOWriteProgressListeners() - { - progressListeners.clear(); - } - - public void removeAllIIOWriteWarningListeners() - { - progressListeners.clear(); - } - - public void removeIIOWriteProgressListener (IIOWriteProgressListener listener) - { - if (listener == null) - return; - - progressListeners.remove(listener); - } - - public void removeIIOWriteWarningListener (IIOWriteWarningListener listener) - { - if (listener == null) - return; - - warningListeners.remove(listener); - } - - public void reset() - { - setOutput(null); - setLocale(null); - removeAllIIOWriteWarningListeners(); - removeAllIIOWriteProgressListeners(); - clearAbortRequest(); - } - - public void setLocale(Locale locale) - { - if (locale != null) - { - // Check if its a valid locale. - boolean found = false; - - if (availableLocales != null) - for (int i = availableLocales.length - 1; i >= 0; --i) - if (availableLocales[i].equals(locale)) - found = true; - - if (! found) - throw new IllegalArgumentException("looale not available"); - } - - this.locale = locale; - } - - public void setOutput(Object output) - { - if (output != null) - { - // Check if its a valid output object. - boolean found = false; - Class[] types = null; - - if (originatingProvider != null) - types = originatingProvider.getOutputTypes(); - - if (types != null) - for (int i = types.length - 1; i >= 0; --i) - if (types[i].isInstance(output)) - found = true; - - if (! found) - throw new IllegalArgumentException("output type not available"); - } - - this.output = output; - } - - public abstract void write (IIOMetadata streamMetadata, IIOImage image, ImageWriteParam param) - throws IOException; -} diff --git a/libjava/javax/imageio/event/IIOReadProgressListener.java b/libjava/javax/imageio/event/IIOReadProgressListener.java deleted file mode 100644 index 404336c24bf..00000000000 --- a/libjava/javax/imageio/event/IIOReadProgressListener.java +++ /dev/null @@ -1,117 +0,0 @@ -/* IIOReadProgressListener.java -- - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.event; - -import java.util.EventListener; - -import javax.imageio.ImageReader; - -public interface IIOReadProgressListener extends EventListener -{ - /** - * Reports that the current image read operation has completed. - * - * @param source the <code>ImageReader</code> object calling this method - */ - void imageComplete(ImageReader source); - - /** - * Reports the approximate percentage of completions of this image read - * operation. - * - * @param source the <code>ImageReader</code> object calling this method - * @param percentageDone the approximate percentage of encoding completed - */ - void imageProgress(ImageReader source, float percentageDone); - - /** - * Reports that the current image read operation has started. - * - * @param source the <code>ImageReader</code> object calling this method - * @param imageIndex the index of the image to read - */ - void imageStarted(ImageReader source, int imageIndex); - - /** - * Reports that a read operation has been aborted. - * - * @param source the <code>ImageReader</code> object calling this method - */ - void readAborted(ImageReader source); - - /** - * Reports that a sequence of read operationshas completed. - * - * @param source the <code>ImageReader</code> object calling this method - */ - void sequenceComplete(ImageReader source); - - /** - * Reports that a sequence of read operations is beginning. - * - * @param source the <code>ImageReader</code> object calling this method - * @param minIndex the index of the first image to be read - */ - void sequenceStarted(ImageReader source, int minIndex); - - /** - * Reports that a thumbnail read operation has completed. - * - * @param source the <code>ImageReader</code> object calling this method - */ - void thumbnailComplete(ImageReader source); - - /** - * Reports the approximate percentage of completion of a thumbnail read - * operation. - * - * @param source the <code>ImageReader</code> object calling this method - * @param percentageDone the approximate percentage of encoding completed - */ - void thumbnailProgress(ImageReader source, float percentageDone); - - /** - * Reports that a thumbnail read operation is beginning. - * - * @param source the <code>ImageReader</code> object calling this method - * @param imageIndex the index of the image being read - * @param thumbnailIndex the index of the thumbnail being read - */ - void thumbnailStarted(ImageReader source, int imageIndex, int thumbnailIndex); -} diff --git a/libjava/javax/imageio/event/IIOReadUpdateListener.java b/libjava/javax/imageio/event/IIOReadUpdateListener.java deleted file mode 100644 index 77b1a4e0718..00000000000 --- a/libjava/javax/imageio/event/IIOReadUpdateListener.java +++ /dev/null @@ -1,133 +0,0 @@ -/* IIOReadUpdateListener.java -- - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.event; - -import java.awt.image.BufferedImage; -import java.util.EventListener; - -import javax.imageio.ImageReader; - -public interface IIOReadUpdateListener extends EventListener -{ - /** - * Reports that a given region of the image has been updated. - * - * @param source the <code>ImageReader</code> object calling this method - * @param image the BufferedImage being updated - * @param minX the X coordinate of the leftmost updated column of pixels - * @param minY the Y coordinate of the uppermost updated row of pixels - * @param width the number of updated pixels horizontally - * @param height the number of updated pixels vertically - * @param periodX the horizontal spacing between updated pixels; a value of 1 means no gaps - * @param periodY the vertical spacing between updated pixels; a value of 1 means no gaps - * @param bands an array of <code>int</code>s indicating which bands are being updated - */ - void imageUpdate(ImageReader source, BufferedImage image, int minX, - int minY, int width, int height, int periodX, int periodY, - int[] bands); - - /** - * Reports that the current read operation has completed a progressive pass. - * - * @param source the <code>ImageReader</code> object calling this method - * @param image the BufferedImage being updated - */ - void passComplete(ImageReader source, BufferedImage image); - - /** - * Reports that the current read operation is about to begin a progressive pass. - * - * @param source the <code>ImageReader</code> object calling this method - * @param image the BufferedImage being updated - * @param pass the numer of the pass that is about to begin, starting with 0 - * @param minPass the index of the first pass that will be decoded - * @param maxPass the index of the last pass that will be decoded - * @param minX the X coordinate of the leftmost updated column of pixels - * @param minY the Y coordinate of the uppermost updated row of pixels - * @param periodX the horizontal spacing between updated pixels; a value of 1 means no gaps - * @param periodY the vertical spacing between updated pixels; a value of 1 means no gaps - * @param bands an array of <code>int</code>s indicating which bands are being updated - */ - void passStarted(ImageReader source, BufferedImage image, int pass, - int minPass, int maxPass, int minX, int minY, int periodX, - int periodY, int[] bands); - - /** - * Reports that the current thumbnail read operation has completed a progressive pass. - * - * @param source the <code>ImageReader</code> object calling this method - * @param image the BufferedImage being updated - */ - void thumbnailPassComplete(ImageReader source, BufferedImage image); - - /** - * Reports that the current thumbnail read operation is about to begin a progressive pass. - * - * @param source the <code>ImageReader</code> object calling this method - * @param image the BufferedImage being updated - * @param pass the numer of the pass that is about to begin, starting with 0 - * @param minPass the index of the first pass that will be decoded - * @param maxPass the index of the last pass that will be decoded - * @param minX the X coordinate of the leftmost updated column of pixels - * @param minY the Y coordinate of the uppermost updated row of pixels - * @param periodX the horizontal spacing between updated pixels; a value of 1 means no gaps - * @param periodY the vertical spacing between updated pixels; a value of 1 means no gaps - * @param bands an array of <code>int</code>s indicating which bands are being updated - */ - void thumbnailPassStarted(ImageReader source, BufferedImage image, int pass, - int minPass, int maxPass, int minX, int minY, - int periodX, int periodY, int[] bands); - - /** - * Reports that a given region of a thumbnail image has been updated. - * - * @param source the <code>ImageReader</code> object calling this method - * @param image the BufferedImage being updated - * @param minX the X coordinate of the leftmost updated column of pixels - * @param minY the Y coordinate of the uppermost updated row of pixels - * @param width the number of updated pixels horizontally - * @param height the number of updated pixels vertically - * @param periodX the horizontal spacing between updated pixels; a value of 1 means no gaps - * @param periodY the vertical spacing between updated pixels; a value of 1 means no gaps - * @param bands an array of <code>int</code>s indicating which bands are being updated - */ - void thumbnailUpdate(ImageReader source, BufferedImage image, int minX, - int minY, int width, int height, int periodX, - int periodY, int[] bands); -} diff --git a/libjava/javax/imageio/event/IIOReadWarningListener.java b/libjava/javax/imageio/event/IIOReadWarningListener.java deleted file mode 100644 index e89735035ff..00000000000 --- a/libjava/javax/imageio/event/IIOReadWarningListener.java +++ /dev/null @@ -1,55 +0,0 @@ -/* IIOReadProgressListener.java -- - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.event; - -import java.util.EventListener; - -import javax.imageio.ImageReader; - -public interface IIOReadWarningListener extends EventListener -{ - /** - * Reports the occurrence of a non-fatal error in decoding. - * Decoding will continue after this method is called. - * - * @param source the <code>ImageReader</code> object calling this method - * @param warning the warning - */ - void warningOccurred(ImageReader source, String warning); -} diff --git a/libjava/javax/imageio/event/IIOWriteProgressListener.java b/libjava/javax/imageio/event/IIOWriteProgressListener.java deleted file mode 100644 index 16b8891f0f2..00000000000 --- a/libjava/javax/imageio/event/IIOWriteProgressListener.java +++ /dev/null @@ -1,102 +0,0 @@ -/* IIOWriteProgressListener.java -- - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.event; - -import java.util.EventListener; - -import javax.imageio.ImageWriter; - -public interface IIOWriteProgressListener extends EventListener -{ - /** - * Reports that an image write operation has completed. - * - * @param source the <code>ImageWriter</code> object calling this method - */ - void imageComplete(ImageWriter source); - - /** - * Reports the approximate percentage of completion of an image write - * operation. - * - * @param source the <code>ImageWriter</code> object calling this method - * @param percentageDone the approximate percentage of decoding completed - */ - void imageProgress(ImageWriter source, float percentageDone); - - /** - * Reports that a thumbnail write operation has started. - * - * @param source the <code>ImageWriter</code> object calling this method - * @param imageIndex the index of the image being written - */ - void imageStarted(ImageWriter source, int imageIndex); - - /** - * Reports that a thumbnail write operation has completed. - * - * @param source the <code>ImageWriter</code> object calling this method - */ - void thumbnailComplete(ImageWriter source); - - /** - * Reports the approximate percentage of completion of a thumbnail write - * operation. - * - * @param source the <code>ImageWriter</code> object calling this method - * @param percentageDone the approximate percentage of decoding completed - */ - void thumbnailProgress(ImageWriter source, float percentageDone); - - /** - * Reports that a thumbnail write operation is beginning. - * - * @param source the <code>ImageWriter</code> object calling this method - * @param imageIndex the index of the image being written - * @param thumnailIndex the index of the thumbnail being written - */ - void thumbnailStarted(ImageWriter source, int imageIndex, int thumnailIndex); - - /** - * Reports that an image write operation is aborted. - * - * @param source the <code>ImageWriter</code> object calling this method - */ - void writeAborted(ImageWriter source); -} diff --git a/libjava/javax/imageio/event/IIOWriteWarningListener.java b/libjava/javax/imageio/event/IIOWriteWarningListener.java deleted file mode 100644 index 3c4e3bd99de..00000000000 --- a/libjava/javax/imageio/event/IIOWriteWarningListener.java +++ /dev/null @@ -1,60 +0,0 @@ -/* IIOWriteWarningListener.java -- - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.event; - -import java.util.EventListener; - -import javax.imageio.ImageWriter; - -/** - * @author Michael Koch (konqueror@gmx.de) - */ -public interface IIOWriteWarningListener extends EventListener -{ - /** - * Reports the occurrence of a non-fatal error in encoding. - * Encoding will continue after this method is called. - * - * @param source the <code>ImageWriter</code> object calling this method - * @param imageIndex the index of the image generating this warning, - * starting with 0 - * @param warning the warning - */ - void warningOccurred(ImageWriter source, int imageIndex, String warning); -} diff --git a/libjava/javax/imageio/metadata/IIOAttr.java b/libjava/javax/imageio/metadata/IIOAttr.java deleted file mode 100644 index 0c1d3d2ef3f..00000000000 --- a/libjava/javax/imageio/metadata/IIOAttr.java +++ /dev/null @@ -1,378 +0,0 @@ -/* IIOAttr.java -- - Copyright (C) 2004, 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.metadata; - -import org.w3c.dom.Attr; -import org.w3c.dom.DOMException; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.w3c.dom.TypeInfo; -import org.w3c.dom.UserDataHandler; - -/** - * Simple Attr node for metadata trees - * - * @author jlquinn - */ -class IIOAttr implements Attr -{ - String name; - String value; - IIOMetadataNode owner; - - public IIOAttr(String name, String value, IIOMetadataNode owner) - { - this.name = name; - this.value = value; - this.owner = owner; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Attr#getName() - */ - public String getName() - { - return name; - } - - public TypeInfo getSchemaTypeInfo() - { - throw new Error("not implemented"); - } - - /* (non-Javadoc) - * @see org.w3c.dom.Attr#getSpecified() - */ - public boolean getSpecified() - { - // I don't think there can be default attrs in metadata - return true; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Attr#getValue() - */ - public String getValue() - { - return value; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Attr#setValue(java.lang.String) - */ - public void setValue(String value) throws DOMException - { - this.value = value; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Attr#getOwnerElement() - */ - public Element getOwnerElement() - { - return owner; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#getNodeName() - */ - public String getNodeName() - { - return name; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#getNodeValue() - */ - public String getNodeValue() throws DOMException - { - return value; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#setNodeValue(java.lang.String) - */ - public void setNodeValue(String nodeValue) throws DOMException - { - this.value = nodeValue; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#getNodeType() - */ - public short getNodeType() - { - return ATTRIBUTE_NODE; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#getParentNode() - */ - public Node getParentNode() - { - return null; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#getChildNodes() - */ - public NodeList getChildNodes() - { - return null; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#getFirstChild() - */ - public Node getFirstChild() - { - return null; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#getLastChild() - */ - public Node getLastChild() - { - return null; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#getPreviousSibling() - */ - public Node getPreviousSibling() - { - return null; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#getNextSibling() - */ - public Node getNextSibling() - { - return null; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#getAttributes() - */ - public NamedNodeMap getAttributes() - { - return null; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#getOwnerDocument() - */ - public Document getOwnerDocument() - { - return null; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#insertBefore(org.w3c.dom.Node, org.w3c.dom.Node) - */ - public Node insertBefore(Node newChild, Node refChild) throws DOMException - { - return null; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#replaceChild(org.w3c.dom.Node, org.w3c.dom.Node) - */ - public Node replaceChild(Node newChild, Node oldChild) throws DOMException - { - return null; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#removeChild(org.w3c.dom.Node) - */ - public Node removeChild(Node oldChild) throws DOMException - { - return null; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#appendChild(org.w3c.dom.Node) - */ - public Node appendChild(Node newChild) throws DOMException - { - return null; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#hasChildNodes() - */ - public boolean hasChildNodes() - { - return false; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#cloneNode(boolean) - */ - public Node cloneNode(boolean deep) - { - return new IIOAttr(name, value, owner); - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#normalize() - */ - public void normalize() - { - } - - public boolean isDefaultNamespace(String namespaceURI) - { - throw new Error("not implemented"); - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#isSupported(java.lang.String, java.lang.String) - */ - public boolean isSupported(String feature, String version) - { - return false; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#getNamespaceURI() - */ - public String getNamespaceURI() - { - return null; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#getPrefix() - */ - public String getPrefix() - { - return null; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#setPrefix(java.lang.String) - */ - public void setPrefix(String prefix) throws DOMException - { - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#getLocalName() - */ - public String getLocalName() - { - return name; - } - - public Object getUserData(String key) - { - throw new Error("not implemented"); - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#hasAttributes() - */ - public boolean hasAttributes() - { - return false; - } - - public boolean isId() - { - throw new Error("not implemented"); - } - - public String lookupNamespaceURI(String prefix) - { - throw new Error("not implemented"); - } - - public String lookupPrefix(String namespaceURI) - { - throw new Error("not implemented"); - } - - public Object setUserData(String key, Object data, UserDataHandler handler) - { - throw new Error("not implemented"); - } - - public String getBaseURI() - { - throw new Error("not implemented"); - } - - public String getTextContent() - { - throw new Error("not implemented"); - } - - public void setTextContent(String textContent) - { - throw new Error("not implemented"); - } - - public short compareDocumentPosition(Node other) - throws DOMException - { - throw new Error("not implemented"); - } - - public Object getFeature(String feature, String version) - { - throw new Error("not implemented"); - } - - public boolean isEqualNode(Node other) - { - throw new Error("not implemented"); - } - - public boolean isSameNode(Node other) - { - throw new Error("not implemented"); - } -} diff --git a/libjava/javax/imageio/metadata/IIOInvalidTreeException.java b/libjava/javax/imageio/metadata/IIOInvalidTreeException.java deleted file mode 100644 index 18d5bf617b1..00000000000 --- a/libjava/javax/imageio/metadata/IIOInvalidTreeException.java +++ /dev/null @@ -1,68 +0,0 @@ -/* IIOInvalidTreeException.java -- - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.metadata; - -import javax.imageio.IIOException; - -import org.w3c.dom.Node; - -public class IIOInvalidTreeException extends IIOException -{ - private static final long serialVersionUID = -1314083172544132777L; - - protected Node offendingNode; - - public IIOInvalidTreeException(String message, Node offendingNode) - { - super(message); - this.offendingNode = offendingNode; - } - - public IIOInvalidTreeException(String message, Throwable cause, - Node offendingNode) - { - super(message, cause); - this.offendingNode = offendingNode; - } - - public Node getOffendingNode() - { - return offendingNode; - } -} diff --git a/libjava/javax/imageio/metadata/IIOMetadata.java b/libjava/javax/imageio/metadata/IIOMetadata.java deleted file mode 100644 index d727e1d1e51..00000000000 --- a/libjava/javax/imageio/metadata/IIOMetadata.java +++ /dev/null @@ -1,213 +0,0 @@ -/* IIOMetadata.java -- - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.metadata; - -/** - * @author Michael Koch (konqueror@gmx.de) - */ -public abstract class IIOMetadata -{ - protected IIOMetadataController controller; - protected IIOMetadataController defaultController; - protected String[] extraMetadataFormatClassNames; - protected String[] extraMetadataFormatNames; - protected String nativeMetadataFormatClassName; - protected String nativeMetadataFormatName; - protected boolean standardFormatSupported; - - /** - * Creates a <code>IIOMetaData</code> object. - */ - protected IIOMetadata() - { - // Do nothing here. - } - - /** - * Creates a <code>IIOMetaData</code> object with the given arguments. - * - * @param standardMetadataFormatSupported - * @param nativeMetadataFormatName - * @param nativeMetadataFormatClassName - * @param extraMetadataFormatNames - * @param extraMetadataFormatClassNames - * - * @throws IllegalArgumentException if extraMetadataFormatNames has length of - * zero or extraMetadataFormatNames and extraMetadataFormatClassNames are - * neither both null, not have the same length - */ - protected IIOMetadata(boolean standardMetadataFormatSupported, - String nativeMetadataFormatName, - String nativeMetadataFormatClassName, - String[] extraMetadataFormatNames, - String[] extraMetadataFormatClassNames) - { - if (extraMetadataFormatNames != null - && extraMetadataFormatNames.length == 0) - throw new IllegalArgumentException - ("extraMetadataFormatNames may not be empty"); - - if (((extraMetadataFormatNames == null) - && (extraMetadataFormatClassNames != null)) - || ((extraMetadataFormatNames != null) - && (extraMetadataFormatClassNames == null)) - || ((extraMetadataFormatNames != null) - && (extraMetadataFormatClassNames != null) - && (extraMetadataFormatNames.length != - extraMetadataFormatClassNames.length))) - throw new IllegalArgumentException - ("extraMetadataFormatNames and extraMetadataFormatClassNames " + - "have different lengths"); - - this.standardFormatSupported = standardMetadataFormatSupported; - this.nativeMetadataFormatName = nativeMetadataFormatName; - this.nativeMetadataFormatClassName = nativeMetadataFormatClassName; - this.extraMetadataFormatNames = extraMetadataFormatNames; - this.extraMetadataFormatClassNames = extraMetadataFormatClassNames; - } - - public boolean activateController() - { - if (! hasController()) - return false; - - return getDefaultController().activate(this); - } - - public IIOMetadataController getController() - { - return controller; - } - - public IIOMetadataController getDefaultController() - { - return defaultController; - } - - public String[] getExtraMetadataFormatNames() - { - return (String[]) extraMetadataFormatNames.clone(); - } - - public IIOMetadataFormat getMetadataFormat(String formatName) - { - if (formatName == null) - throw new IllegalArgumentException("formatName may not be null"); - - String formatClassName = null; - - if (isStandardMetadataFormatSupported() - && formatName.equals(nativeMetadataFormatName)) - formatClassName = nativeMetadataFormatClassName; - else - { - String[] extraFormatNames = getExtraMetadataFormatNames(); - - for (int i = extraFormatNames.length - 1; i >= 0; --i) - if (extraFormatNames[i].equals(formatName)) - { - formatClassName = extraFormatNames[i]; - break; - } - } - - if (formatClassName == null) - throw new IllegalArgumentException("unknown format"); - - IIOMetadataFormat format; - - try - { - format = (IIOMetadataFormat) Class.forName(formatClassName) - .newInstance(); - } - catch (Exception e) - { - IllegalStateException ise = new IllegalStateException(); - ise.initCause(e); - throw ise; - } - - return format; - } - - public String[] getMetadataFormatNames() - { - String[] formatNames = getExtraMetadataFormatNames(); - - if (isStandardMetadataFormatSupported()) - { - // Combine native metadata format name and extra metadata format names - // into one String array. - String[] tmp = new String[formatNames.length + 1]; - tmp[0] = getNativeMetadataFormatName(); - - for (int i = 1; i < tmp.length; ++i) - tmp[i] = formatNames[i - 1]; - - formatNames = tmp; - } - - return formatNames; - } - - public String getNativeMetadataFormatName() - { - return nativeMetadataFormatName; - } - - public boolean hasController() - { - return getController() != null; - } - - public abstract boolean isReadOnly(); - - public boolean isStandardMetadataFormatSupported() - { - return standardFormatSupported; - } - - public abstract void reset(); - - public void setController(IIOMetadataController controller) - { - this.controller = controller; - } -} diff --git a/libjava/javax/imageio/metadata/IIOMetadataController.java b/libjava/javax/imageio/metadata/IIOMetadataController.java deleted file mode 100644 index 86e544386ee..00000000000 --- a/libjava/javax/imageio/metadata/IIOMetadataController.java +++ /dev/null @@ -1,47 +0,0 @@ -/* IIOMetadataController.java -- - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.metadata; - -/** - * @author Michael Koch (konqueror@gmx.de) - */ -public interface IIOMetadataController -{ - boolean activate(IIOMetadata metadata); -} diff --git a/libjava/javax/imageio/metadata/IIOMetadataFormat.java b/libjava/javax/imageio/metadata/IIOMetadataFormat.java deleted file mode 100644 index 76e0950a3df..00000000000 --- a/libjava/javax/imageio/metadata/IIOMetadataFormat.java +++ /dev/null @@ -1,124 +0,0 @@ -/* IIOMetadataFormat.java -- - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.metadata; - -import java.util.Locale; - -import javax.imageio.ImageTypeSpecifier; - -/** - * @author Michael Koch (konqueror@gmx.de) - */ -public interface IIOMetadataFormat -{ - int CHILD_POLICY_ALL = 1; - int CHILD_POLICY_CHOICE = 3; - int CHILD_POLICY_EMPTY = 0; - int CHILD_POLICY_MAX = 5; - int CHILD_POLICY_REPEAT = 5; - int CHILD_POLICY_SEQUENCE = 4; - int CHILD_POLICY_SOME = 2; - int DATATYPE_BOOLEAN = 1; - int DATATYPE_DOUBLE = 4; - int DATATYPE_FLOAT = 3; - int DATATYPE_INTEGER = 2; - int DATATYPE_STRING = 0; - int VALUE_ARBITRARY = 1; - int VALUE_ENUMERATION = 16; - int VALUE_LIST = 32; - int VALUE_NONE = 0; - int VALUE_RANGE = 2; - int VALUE_RANGE_MAX_INCLUSIVE = 10; - int VALUE_RANGE_MAX_INCLUSIVE_MASK = 8; - int VALUE_RANGE_MIN_INCLUSIVE = 6; - int VALUE_RANGE_MIN_INCLUSIVE_MASK = 4; - int VALUE_RANGE_MIN_MAX_INCLUSIVE = 14; - - boolean canNodeAppear (String elementName, ImageTypeSpecifier imageType); - - int getAttributeDataType (String elementName, String attrName); - - String getAttributeDefaultValue (String elementName, String attrName); - - String getAttributeDescription (String elementName, String attrName, Locale locale); - - String[] getAttributeEnumerations (String elementName, String attrName); - - int getAttributeListMaxLength (String elementName, String attrName); - - int getAttributeListMinLength (String elementName, String attrName); - - String getAttributeMaxValue (String elementName, String attrName); - - String getAttributeMinValue (String elementName, String attrName); - - String[] getAttributeNames (String elementName); - - int getAttributeValueType (String elementName, String attrName); - - String[] getChildNames (String elementName); - - int getChildPolicy (String elementName); - - String getElementDescription (String elementName, Locale locale); - - int getElementMaxChildren (String elementName); - - int getElementMinChildren (String elementName); - - int getObjectArrayMaxLength (String elementName); - - int getObjectArrayMinLength (String elementName); - - Class getObjectClass (String elementName); - - Object getObjectDefaultValue (String elementName); - - Object[] getObjectEnumerations (String elementName); - - Comparable getObjectMaxValue (String elementName); - - Comparable getObjectMinValue (String elementName); - - int getObjectValueType (String elementName); - - String getRootName(); - - boolean isAttributeRequired (String elementName, String attrName); -} diff --git a/libjava/javax/imageio/metadata/IIOMetadataFormatImpl.java b/libjava/javax/imageio/metadata/IIOMetadataFormatImpl.java deleted file mode 100644 index 2ce8f9c3d4b..00000000000 --- a/libjava/javax/imageio/metadata/IIOMetadataFormatImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -/* IIOMetadataFormatImpl.java -- - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.metadata; - -public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat -{ -} diff --git a/libjava/javax/imageio/metadata/IIOMetadataNode.java b/libjava/javax/imageio/metadata/IIOMetadataNode.java deleted file mode 100644 index d9e0983e94a..00000000000 --- a/libjava/javax/imageio/metadata/IIOMetadataNode.java +++ /dev/null @@ -1,592 +0,0 @@ -/* IIOMetadataNode.java -- - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.metadata; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; - -import org.w3c.dom.Attr; -import org.w3c.dom.DOMException; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.w3c.dom.TypeInfo; -import org.w3c.dom.UserDataHandler; - -public class IIOMetadataNode - implements Element, NodeList -{ - private String name; - private HashMap attrs = new HashMap(); - private List children = new ArrayList(); - private IIOMetadataNode parent; - private Object obj; - - public IIOMetadataNode() - { - // Do nothing here. - } - - public IIOMetadataNode(String nodename) - { - name = nodename; - } - - public Object getUserObject() - { - return obj; - } - - public void setUserObject(Object o) - { - obj = o; - } - - public short compareDocumentPosition(Node other) - throws DOMException - { - throw new Error("not implemented"); - } - - /* (non-Javadoc) - * @see org.w3c.dom.Element#getAttribute(java.lang.String) - */ - public String getAttribute(String name) - { - Attr anode = (Attr) attrs.get(name); - return anode != null ? anode.getValue() : null; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Element#getAttributeNode(java.lang.String) - */ - public Attr getAttributeNode(String name) - { - String val = getAttribute(name); - if (val != null) - return new IIOAttr(name, val, this); - return null; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Element#getAttributeNodeNS(java.lang.String, java.lang.String) - */ - public Attr getAttributeNodeNS(String namespaceURI, String localName) - { - return getAttributeNode(localName); - } - - /* (non-Javadoc) - * @see org.w3c.dom.Element#getAttributeNS(java.lang.String, java.lang.String) - */ - public String getAttributeNS(String namespaceURI, String localName) - { - return getAttribute(localName); - } - - public String getBaseURI() - { - throw new Error("not implemented"); - } - - // Recursive function for assembling a node list. - private void getElementsRecurse(IIONodeList list, String name) - { - for (int i=0; i < children.size(); i++) - { - if (((Node)children.get(i)).getNodeName().equals(name)) - list.children.add(children.get(i)); - getElementsRecurse(list, name); - } - } - - /* (non-Javadoc) - * @see org.w3c.dom.Element#getElementsByTagName(java.lang.String) - */ - public NodeList getElementsByTagName(String name) - { - IIONodeList list = new IIONodeList(); - getElementsRecurse(list, name); - return list; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Element#getElementsByTagNameNS(java.lang.String, java.lang.String) - */ - public NodeList getElementsByTagNameNS(String namespaceURI, String localName) - { - IIONodeList list = new IIONodeList(); - getElementsRecurse(list, name); - return list; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Element#getTagName() - */ - public String getTagName() - { - return name; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Element#hasAttribute(java.lang.String) - */ - public boolean hasAttribute(String name) - { - return attrs.containsKey(name); - } - - /* (non-Javadoc) - * @see org.w3c.dom.Element#hasAttributeNS(java.lang.String, java.lang.String) - */ - public boolean hasAttributeNS(String namespaceURI, String localName) - { - return attrs.containsKey(localName); - } - - /* (non-Javadoc) - * @see org.w3c.dom.Element#removeAttribute(java.lang.String) - */ - public void removeAttribute(String name) - { - attrs.remove(name); - } - - /* (non-Javadoc) - * @see org.w3c.dom.Element#removeAttributeNode(org.w3c.dom.Attr) - */ - public Attr removeAttributeNode(Attr oldAttr) - { - return (Attr)attrs.remove(oldAttr.getName()); - } - - /* (non-Javadoc) - * @see org.w3c.dom.Element#removeAttributeNS(java.lang.String, java.lang.String) - */ - public void removeAttributeNS(String namespaceURI, String localName) - { - removeAttribute(localName); - } - - /* (non-Javadoc) - * @see org.w3c.dom.Element#setAttribute(java.lang.String, java.lang.String) - */ - public void setAttribute(String name, String value) - { - Attr attr = (Attr) getAttributeNode(name); - if (attr != null) - attr.setValue(value); - else - attrs.put(name, new IIOAttr(name, value, this)); - } - - /* (non-Javadoc) - * @see org.w3c.dom.Element#setAttributeNode(org.w3c.dom.Attr) - */ - public Attr setAttributeNode(Attr newAttr) - { - return (Attr)attrs.put(newAttr.getName(), newAttr); - } - - /* (non-Javadoc) - * @see org.w3c.dom.Element#setAttributeNodeNS(org.w3c.dom.Attr) - */ - public Attr setAttributeNodeNS(Attr newAttr) - { - return (Attr)attrs.put(newAttr.getName(), newAttr); - } - - /* (non-Javadoc) - * @see org.w3c.dom.Element#setAttributeNS(java.lang.String, java.lang.String, java.lang.String) - */ - public void setAttributeNS(String namespaceURI, String qualifiedName, String value) - { - setAttribute(qualifiedName, value); - } - - /* (non-Javadoc) - * @see org.w3c.dom.NodeList#getLength() - */ - public int getLength() - { - return children.size(); - } - - /* (non-Javadoc) - * @see org.w3c.dom.NodeList#item(int) - */ - public Node item(int index) - { - if (index < children.size()) - return (Node)children.get(index); - else - return null; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#appendChild(org.w3c.dom.Node) - */ - public Node appendChild(Node newChild) - { - if (newChild == null) - throw new IllegalArgumentException("Child node is null"); - - IIOMetadataNode child = (IIOMetadataNode) newChild; - - children.add(child); - child.parent = this; - return this; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#cloneNode(boolean) - */ - public Node cloneNode(boolean deep) - { - IIOMetadataNode newnode = new IIOMetadataNode(name); - newnode.parent = null; - newnode.obj = obj; - if (deep) - { - for (int i=0; i < children.size(); i++) - newnode.children.add(((Node)children.get(i)).cloneNode(deep)); - } - - // clone attrs - for (Iterator it = attrs.values().iterator(); it.hasNext();) - { - IIOAttr attr = (IIOAttr)it.next(); - newnode.attrs.put(attr.name, attr.cloneNode(deep)); - attr.owner = newnode; - } - - return newnode; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#getAttributes() - */ - public NamedNodeMap getAttributes() - { - return new IIONamedNodeMap(attrs); - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#getChildNodes() - */ - public NodeList getChildNodes() - { - return this; - } - - public Object getFeature(String feature, String version) - { - throw new Error("not implemented"); - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#getFirstChild() - */ - public Node getFirstChild() - { - return (children.size() > 0) ? (Node)children.get(0) : null; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#getLastChild() - */ - public Node getLastChild() - { - return (children.size() > 0) ? (Node)children.get(children.size() - 1) - : null; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#getLocalName() - */ - public String getLocalName() - { - return name; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#getNamespaceURI() - */ - public String getNamespaceURI() - { - return null; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#getNextSibling() - */ - public Node getNextSibling() - { - // If this op needs to be faster, add links to prev and next nodes. - if (parent == null) return null; - int idx = parent.children.indexOf(this); - return (idx == parent.children.size() - 1) ? null - : (Node)parent.children.get(idx + 1); - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#getNodeName() - */ - public String getNodeName() - { - return name; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#getNodeType() - */ - public short getNodeType() - { - return ELEMENT_NODE; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#getNodeValue() - */ - public String getNodeValue() - { - return null; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#getOwnerDocument() - */ - public Document getOwnerDocument() - { - // IOMetadataNodes have no owner - return null; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#getParentNode() - */ - public Node getParentNode() - { - return parent; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#getPrefix() - */ - public String getPrefix() - { - return null; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#getPreviousSibling() - */ - public Node getPreviousSibling() - { - // If this op needs to be faster, add links to prev and next nodes. - if (parent == null) return null; - int idx = parent.children.indexOf(this); - return (idx == 0) ? null - : (Node)parent.children.get(idx - 1); - } - - public TypeInfo getSchemaTypeInfo() - { - throw new Error("not implemented"); - } - - public String getTextContent() - throws DOMException - { - throw new Error("not implemented"); - } - - public Object getUserData(String key) - { - throw new Error("not implemented"); - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#hasAttributes() - */ - public boolean hasAttributes() - { - return !attrs.isEmpty(); - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#hasChildNodes() - */ - public boolean hasChildNodes() - { - return !children.isEmpty(); - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#insertBefore(org.w3c.dom.Node, org.w3c.dom.Node) - */ - public Node insertBefore(Node newChild, Node refChild) - { - if (newChild == null) - throw new IllegalArgumentException(); - - int idx = children.indexOf(refChild); - if (idx == -1) - children.add(newChild); - else - children.add(idx, newChild); - ((IIOMetadataNode)newChild).parent = this; - - return newChild; - } - - public boolean isDefaultNamespace(String namespaceURI) - { - throw new Error("not implemented"); - } - - public boolean isEqualNode(Node arg) - { - throw new Error("not implemented"); - } - - public boolean isSameNode(Node other) - { - return this == other; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#isSupported(java.lang.String, java.lang.String) - */ - public boolean isSupported(String feature, String version) - { - // No DOM features are supported - return false; - } - - public String lookupNamespaceURI(String prefix) - { - throw new Error("not implemented"); - } - - public String lookupPrefix(String namespaceURI) - { - throw new Error("not implemented"); - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#normalize() - */ - public void normalize() - { - // No text nodes so no action - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#removeChild(org.w3c.dom.Node) - */ - public Node removeChild(Node oldChild) - { - if (oldChild == null) - throw new IllegalArgumentException(); - children.remove(oldChild); - ((IIOMetadataNode)oldChild).parent = null; - - return oldChild; - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#replaceChild(org.w3c.dom.Node, org.w3c.dom.Node) - */ - public Node replaceChild(Node newChild, Node oldChild) - { - if (newChild == null) - throw new IllegalArgumentException(); - children.set(children.indexOf(oldChild), newChild); - ((IIOMetadataNode)oldChild).parent = null; - return oldChild; - } - - public void setIdAttribute(String name, boolean isId) - throws DOMException - { - throw new Error("not implemented"); - } - - public void setIdAttributeNode(Attr idAttr, boolean isId) - throws DOMException - { - throw new Error("not implemented"); - } - - public void setIdAttributeNS(String namespaceURI, String localName, boolean isId) - throws DOMException - { - throw new Error("not implemented"); - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#setNodeValue(java.lang.String) - */ - public void setNodeValue(String nodeValue) throws DOMException - { - } - - /* (non-Javadoc) - * @see org.w3c.dom.Node#setPrefix(java.lang.String) - */ - public void setPrefix(String prefix) - { - } - - public void setTextContent(String textContent) - throws DOMException - { - throw new Error("not implemented"); - } - - public Object setUserData(String key, Object data, UserDataHandler handler) - { - throw new Error("not implemented"); - } -} diff --git a/libjava/javax/imageio/metadata/IIONamedNodeMap.java b/libjava/javax/imageio/metadata/IIONamedNodeMap.java deleted file mode 100644 index 92da28d5bb2..00000000000 --- a/libjava/javax/imageio/metadata/IIONamedNodeMap.java +++ /dev/null @@ -1,138 +0,0 @@ -/* IIONamedNodeMap.java -- - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -package javax.imageio.metadata; - -import java.util.HashMap; - -import org.w3c.dom.DOMException; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; - -/** - * Simple NamedNodeMap class for IIOMetadataNode. - * - * @author jlquinn - */ -class IIONamedNodeMap implements NamedNodeMap -{ - HashMap attrs; - - /** - * @param attrs - * @param node - */ - public IIONamedNodeMap(HashMap attrs) - { - this.attrs = attrs; - } - - /* (non-Javadoc) - * @see org.w3c.dom.NamedNodeMap#getNamedItem(java.lang.String) - */ - public Node getNamedItem(String name) - { - return (Node)attrs.get(name); - } - - /* (non-Javadoc) - * @see org.w3c.dom.NamedNodeMap#setNamedItem(org.w3c.dom.Node) - */ - public Node setNamedItem(Node arg) throws DOMException - { - if (arg instanceof IIOAttr) - { - IIOAttr attr = (IIOAttr) arg; - // The only code that can successfully do this is in this package. - if (attr.owner != null) - throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR, ""); - return (Node)attrs.put(attr.name, attr); - } - // Anything else gets treated as an invalid op. - throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, ""); - } - - /* (non-Javadoc) - * @see org.w3c.dom.NamedNodeMap#removeNamedItem(java.lang.String) - */ - public Node removeNamedItem(String name) throws DOMException - { - return (Node)attrs.remove(name); - } - - /* (non-Javadoc) - * @see org.w3c.dom.NamedNodeMap#item(int) - */ - public Node item(int index) - { - return (Node)attrs.values().toArray()[index]; - } - - /* (non-Javadoc) - * @see org.w3c.dom.NamedNodeMap#getLength() - */ - public int getLength() - { - return attrs.size(); - } - - /* (non-Javadoc) - * @see org.w3c.dom.NamedNodeMap#getNamedItemNS(java.lang.String, java.lang.String) - */ - public Node getNamedItemNS(String namespaceURI, String localName) - { - return getNamedItem(localName); - } - - /* (non-Javadoc) - * @see org.w3c.dom.NamedNodeMap#setNamedItemNS(org.w3c.dom.Node) - */ - public Node setNamedItemNS(Node arg) throws DOMException - { - return setNamedItem(arg); - } - - /* (non-Javadoc) - * @see org.w3c.dom.NamedNodeMap#removeNamedItemNS(java.lang.String, java.lang.String) - */ - public Node removeNamedItemNS(String namespaceURI, String localName) - throws DOMException - { - return removeNamedItem(localName); - } - -} diff --git a/libjava/javax/imageio/metadata/IIONodeList.java b/libjava/javax/imageio/metadata/IIONodeList.java deleted file mode 100644 index 395d261b6c6..00000000000 --- a/libjava/javax/imageio/metadata/IIONodeList.java +++ /dev/null @@ -1,72 +0,0 @@ -/* IIOAttr.java -- - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -package javax.imageio.metadata; - -import java.util.ArrayList; -import java.util.List; - -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -/** - * Simple NodeList implementation for IIOMetadataNode. - * - * @author jlquinn - * - */ -class IIONodeList implements NodeList -{ - List children = new ArrayList(); - - /* (non-Javadoc) - * @see org.w3c.dom.NodeList#item(int) - */ - public Node item(int index) - { - return (index < children.size()) ? (Node)children.get(index) : null; - } - - /* (non-Javadoc) - * @see org.w3c.dom.NodeList#getLength() - */ - public int getLength() - { - return children.size(); - } - -} diff --git a/libjava/javax/imageio/spi/IIORegistry.java b/libjava/javax/imageio/spi/IIORegistry.java deleted file mode 100644 index a0e11129081..00000000000 --- a/libjava/javax/imageio/spi/IIORegistry.java +++ /dev/null @@ -1,109 +0,0 @@ -/* IIORegistry.java -- - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.spi; - -import gnu.classpath.ServiceFactory; -import gnu.java.awt.ClasspathToolkit; - -import java.awt.Toolkit; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; - -public final class IIORegistry extends ServiceRegistry -{ - private static final HashSet defaultCategories = new HashSet(); - - private static HashMap instances = new HashMap(); - - static - { - defaultCategories.add(ImageReaderSpi.class); - defaultCategories.add(ImageWriterSpi.class); - defaultCategories.add(ImageTranscoderSpi.class); - defaultCategories.add(ImageInputStreamSpi.class); - defaultCategories.add(ImageOutputStreamSpi.class); - } - - public static synchronized IIORegistry getDefaultInstance() - { - ThreadGroup group = Thread.currentThread().getThreadGroup(); - IIORegistry registry = (IIORegistry) instances.get(group); - - if (registry == null) - { - registry = new IIORegistry(); - instances.put(group, registry); - } - - return registry; - } - - private IIORegistry() - { - super(defaultCategories.iterator()); - - // XXX: Register built-in Spis here. - - Toolkit toolkit = Toolkit.getDefaultToolkit(); - if (toolkit instanceof ClasspathToolkit) - ((ClasspathToolkit)toolkit).registerImageIOSpis(this); - - registerApplicationClasspathSpis(); - } - - /** - * Registers all available service providers found on the application - * classpath. - */ - public void registerApplicationClasspathSpis() - { - ClassLoader loader = Thread.currentThread().getContextClassLoader(); - Iterator categories = getCategories(); - - while (categories.hasNext()) - { - Class category = (Class) categories.next(); - Iterator providers = ServiceFactory.lookupProviders(category, loader); - - while (providers.hasNext()) - registerServiceProvider((IIOServiceProvider) providers.next()); - } - } -} diff --git a/libjava/javax/imageio/spi/IIOServiceProvider.java b/libjava/javax/imageio/spi/IIOServiceProvider.java deleted file mode 100644 index 1ec59d5263e..00000000000 --- a/libjava/javax/imageio/spi/IIOServiceProvider.java +++ /dev/null @@ -1,163 +0,0 @@ -/* IIOServiceProvider.java -- General service provider for image I/O. - Copyright (C) 2004, 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.spi; - -import java.util.Locale; - - -/** - * An abstract superclass for service providers that perform image I/O. - * - * @since 1.4 - * - * @author Sascha Brawer (brawer@dandelis.ch) - */ -public abstract class IIOServiceProvider - implements RegisterableService -{ - /** - * The vendor of this service provider, or <code>null</code> if the - * subclass constructor did not set this field. - * - * @see #getVendorName() - */ - protected String vendorName; - - - /** - * The version of this service provider, or <code>null</code> if the - * subclass constructor did not set this field. - * - * @see #getVersion() - */ - protected String version; - - - /** - * Constructs a general <code>IIOServiceProvider</code>, given the - * vendor name and a version string. - * - * @throws IllegalArgumentException if <code>vendorName</code> - * or <code>version</code> is <code>null</code>. - */ - public IIOServiceProvider(String vendorName, String version) - { - if (vendorName == null || version == null) - throw new IllegalArgumentException(); - - this.vendorName = vendorName; - this.version = version; - } - - - /** - * Constructs a general <code>IIOServiceProvider</code> without - * specifying a vendor name and a version string. The subclass - * constructor should set the {@link #vendorName} and {@link - * #version} to non-null values. - */ - public IIOServiceProvider() - { - } - - - /** - * Informs this service provider that it has been registered in a - * {@link ServiceRegistry}. If this provider gets registered as an - * implementor for several service categories, its - * <code>onRegistration</code> method will be called multiple times. - * The default implementation does nothing. - * - * @param registry the registry to which this service provider has - * been added. - * - * @param category the service category for which this provider has - * been registered as an implementor. - */ - public void onRegistration(ServiceRegistry registry, Class category) - { - } - - - /** - * Informs this service provider that it has been de-registered from - * a {@link ServiceRegistry}. If this provider had been registered - * as an implementor for several service categories, its - * <code>onDeregistration</code> method will be called multiple - * times. The default implementation does nothing. - * - * @param registry the registry from which this service provider has - * been removed. - * - * @param category the service category for which this provider has - * been registered as an implementor. - */ - public void onDeregistration(ServiceRegistry registry, Class category) - { - } - - - /** - * Returns the name of the vendor of this service provider. - */ - public String getVendorName() - { - return vendorName; - } - - - /** - * Returns an identifier string for the version of this service - * provider. - */ - public String getVersion() - { - return version; - } - - - /** - * Returns a short description of this service provider that can be - * presented to a human user. - * - * @param locale the locale for which the description string should - * be localized. - */ - public abstract String getDescription(Locale locale); -} diff --git a/libjava/javax/imageio/spi/ImageInputStreamSpi.java b/libjava/javax/imageio/spi/ImageInputStreamSpi.java deleted file mode 100644 index 51c58395fc0..00000000000 --- a/libjava/javax/imageio/spi/ImageInputStreamSpi.java +++ /dev/null @@ -1,144 +0,0 @@ -/* ImageInputStreamSpi.java -- Service provider for image input streams. - Copyright (C) 2004, 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.spi; - -import java.io.File; -import java.io.IOException; - -import javax.imageio.stream.ImageInputStream; - -/** - * An abstract superclass for service providers that create - * {@linkplain javax.imageio.stream.ImageInputStream image input - * streams} for a file, URL, byte array or any other source. - * - * @since 1.4 - * - * @author Sascha Brawer (brawer@dandelis.ch) - */ -public abstract class ImageInputStreamSpi - extends IIOServiceProvider -{ - /** - * Indicates which kind of input is processable by the streams - * created by {@link #createInputStreamInstance(Object)}. - */ - protected Class inputClass; - - - /** - * Constructs a service provider for image input streams, given no - * parameters. It is up to the sub-class to set {@link #vendorName}, - * {@link #version} and {@link #inputClass} to non-null values. - */ - protected ImageInputStreamSpi() - { - } - - - /** - * Constructs a service provider for image input streams, given the - * vendor name and a version string. - * - * @throws IllegalArgumentException if <code>vendorName</code> - * or <code>version</code> is <code>null</code>. - */ - public ImageInputStreamSpi(String vendorName, String version, - Class inputClass) - { - super(vendorName, version); - this.inputClass = inputClass; - } - - - /** - * Determines which kind of input is processable by the streams - * created by {@link #createInputStreamInstance(Object)}. - */ - public Class getInputClass() - { - return inputClass; - } - - - /** - * Determines whether <code>ImageInputStreams</code> created - * by this service provider benefit from using a cache file. - * - * <p>The default behavior is to return <code>false</code>. - * - * @return <code>true</code> if the created streams are faster or - * need less memory when a cache file is being used; - * <code>false</code> if no positive effect results from the cache - * file. - */ - public boolean canUseCacheFile() - { - return false; - } - - - /** - * Determines whether <code>ImageInputStreams</code> created - * by this service provider require the use of a cache file. - * - * <p>The default behavior is to return <code>false</code>. - * - * @return <code>true</code> if the created streams can only work - * when a cache file is being used; <code>false</code> if no cache - * file is needed. - */ - public boolean needsCacheFile() - { - return false; - } - - - public abstract ImageInputStream createInputStreamInstance(Object input, - boolean useCache, - File cacheDir) - throws IOException; - - - public ImageInputStream createInputStreamInstance(Object input) - throws IOException - { - return createInputStreamInstance(input, canUseCacheFile(), null); - } -} diff --git a/libjava/javax/imageio/spi/ImageOutputStreamSpi.java b/libjava/javax/imageio/spi/ImageOutputStreamSpi.java deleted file mode 100644 index 0f1d3cdb2c1..00000000000 --- a/libjava/javax/imageio/spi/ImageOutputStreamSpi.java +++ /dev/null @@ -1,143 +0,0 @@ -/* ImageOutputStreamSpi.java -- Service provider for image output streams. - Copyright (C) 2004, 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.spi; - -import java.io.File; -import java.io.IOException; - -import javax.imageio.stream.ImageOutputStream; - -/** - * An abstract superclass for service providers that create - * {@linkplain javax.imageio.stream.ImageOutputStream image output - * streams} for a file, URL, byte array or any other target. - * - * @since 1.4 - * - * @author Sascha Brawer (brawer@dandelis.ch) - */ -public abstract class ImageOutputStreamSpi - extends IIOServiceProvider -{ - /** - * Indicates which kind of output is produced by the streams - * created by {@link #createOutputStreamInstance(Object)}. - */ - protected Class outputClass; - - - /** - * Constructs a service provider for image output streams, given no - * parameters. It is up to the sub-class to set {@link #vendorName}, - * {@link #version} and {@link #outputClass} to non-null values. - */ - protected ImageOutputStreamSpi() - { - } - - - /** - * Constructs a service provider for image output streams, given the - * vendor name, a version string and the kind of producable output. - * - * @throws IllegalArgumentException if <code>vendorName</code> - * or <code>version</code> is <code>null</code>. - */ - public ImageOutputStreamSpi(String vendorName, String version, - Class outputClass) - { - super(vendorName, version); - this.outputClass = outputClass; - } - - - /** - * Determines which kind of output is produced by the streams - * created by {@link #createOutputStreamInstance(Object)}. - */ - public Class getOutputClass() - { - return outputClass; - } - - - /** - * Determines whether <code>ImageOutputStreams</code> created - * by this service provider benefit from using a cache file. - * - * <p>The default behavior is to return <code>false</code>. - * - * @return <code>true</code> if the created streams are faster or - * need less memory when a cache file is being used; - * <code>false</code> if no positive effect results from the cache - * file. - */ - public boolean canUseCacheFile() - { - return false; - } - - - /** - * Determines whether <code>ImageOutputStreams</code> created - * by this service provider require the use of a cache file. - * - * <p>The default behavior is to return <code>false</code>. - * - * @return <code>true</code> if the created streams can only work - * when a cache file is being used; <code>false</code> if no cache - * file is needed. - */ - public boolean needsCacheFile() - { - return false; - } - - - public abstract ImageOutputStream createOutputStreamInstance( - Object output, boolean useCache, File cacheDir) - throws IOException; - - - public ImageOutputStream createOutputStreamInstance(Object output) - throws IOException - { - return createOutputStreamInstance(output, canUseCacheFile(), null); - } -} diff --git a/libjava/javax/imageio/spi/ImageReaderSpi.java b/libjava/javax/imageio/spi/ImageReaderSpi.java deleted file mode 100644 index e97d23940ca..00000000000 --- a/libjava/javax/imageio/spi/ImageReaderSpi.java +++ /dev/null @@ -1,121 +0,0 @@ -/* ImageReaderSpi.java -- - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.spi; - -import java.io.IOException; - -import javax.imageio.ImageReader; -import javax.imageio.stream.ImageInputStream; - -/** - * @author Michael Koch (konqueror@gmx.de) - */ -public abstract class ImageReaderSpi extends ImageReaderWriterSpi -{ - public static final Class[] STANDARD_INPUT_TYPE = - { ImageInputStream.class }; - - protected Class[] inputTypes; - protected String[] writerSpiNames; - - protected ImageReaderSpi() - { - // Do nothing here. - } - - public ImageReaderSpi(String vendorName, String version, String[] names, - String[] suffixes, String[] MIMETypes, - String readerClassName, 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, readerClassName, - supportsStandardStreamMetadataFormat, nativeStreamMetadataFormatName, - nativeStreamMetadataFormatClassName, extraStreamMetadataFormatNames, - extraStreamMetadataFormatClassNames, supportsStandardImageMetadataFormat, - nativeImageMetadataFormatName, nativeImageMetadataFormatClassName, - extraImageMetadataFormatNames, extraImageMetadataFormatClassNames); - - if (inputTypes == null - || inputTypes.length == 0) - throw new IllegalArgumentException("inputTypes may not be null or empty"); - - this.inputTypes = inputTypes; - this.writerSpiNames = writerSpiNames; - } - - public abstract boolean canDecodeInput(Object source) - throws IOException; - - public ImageReader createReaderInstance() - throws IOException - { - return createReaderInstance(null); - } - - public abstract ImageReader createReaderInstance(Object extension) - throws IOException; - - public String[] getImageWriterSpiNames() - { - return writerSpiNames; - } - - public Class[] getInputTypes() - { - return inputTypes; - } - - public boolean isOwnReader(ImageReader reader) - { - if (reader == null) - throw new IllegalArgumentException("reader may not be null"); - - return pluginClassName.equals(reader.getClass().getName()); - } -} diff --git a/libjava/javax/imageio/spi/ImageReaderWriterSpi.java b/libjava/javax/imageio/spi/ImageReaderWriterSpi.java deleted file mode 100644 index 4aa7fd41272..00000000000 --- a/libjava/javax/imageio/spi/ImageReaderWriterSpi.java +++ /dev/null @@ -1,425 +0,0 @@ -/* ImageReaderWriterSpi.java -- Superclass for image reader and writer spis. - Copyright (C) 2004, 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.spi; - - -/** - * An abstract superclass that contains the common parts of {@link - * javax.imageio.spi.ImageReaderSpi} and {@link - * javax.imageio.spi.ImageWriterSpi}. - * - * @since 1.4 - * - * @author Sascha Brawer (brawer@dandelis.ch) - */ -public abstract class ImageReaderWriterSpi - extends IIOServiceProvider -{ - /** - * The human-readable, localized names of the supported image - * formats. This value should be non-<code>null</code> after - * construction. - * - * @see #getFormatNames() - */ - protected String[] names; - - - /** - * The file suffixes of the supported image formats. This value - * should be non-<code>null</code> after construction. - * - * @see #getFileSuffixes() - */ - protected String[] suffixes; - - - /** - * The MIME types of the supported image formats. This value - * should be non-<code>null</code> after construction. - * - * @see #getMIMETypes() - */ - protected String[] MIMETypes; - - - /** - * The fully qualified name of the class that implements the {@link - * javax.imageio.ImageReader} or {@link javax.imageio.ImageWriter} - * interface. This value should be non-<code>null</code> after - * construction. - * - * @see #getPluginClassName() - */ - protected String pluginClassName; - - - /** - * Indicates whether the per-stream {@linkplain - * javax.imageio.metadata.IIOMetadata metadata objects} associated - * with this plug-in support format - * <code>“javax_imageio_1.0”</code> in their - * <code>getAsTree</code> and <code>setAsTree</code> methods. - * - * @see #isStandardStreamMetadataFormatSupported() - */ - protected boolean supportsStandardStreamMetadataFormat; - - - /** - * The name of the format that allows encoding all stream metadata - * without loss, or <code>null</code> if this plug-in does not - * provide a format that preserves all stream metadata. - */ - protected String nativeStreamMetadataFormatName; - - protected String nativeStreamMetadataFormatClassName; - - - /** - * The names of additional formats for encoding stream metadata, - * other than the {@linkplain - * #isStandardStreamMetadataFormatSupported() standard} and the - * {@linkplain #getNativeStreamMetadataFormatName() native} formats, - * or <code>null</code> if this plug-in does not provide any extra - * formats. - */ - protected String[] extraStreamMetadataFormatNames; - - - protected String[] extraStreamMetadataFormatClassNames; - - - /** - * Indicates whether the per-image {@linkplain - * javax.imageio.metadata.IIOMetadata metadata objects} associated - * with this plug-in support format - * <code>“javax_imageio_1.0”</code> in their - * <code>getAsTree</code> and <code>setAsTree</code> methods. - * - * @see #isStandardImageMetadataFormatSupported() - */ - protected boolean supportsStandardImageMetadataFormat; - - - /** - * The name of the format that allows encoding all image metadata - * without loss, or <code>null</code> if this plug-in does not - * provide a format that preserves all image metadata. - */ - protected String nativeImageMetadataFormatName; - - protected String nativeImageMetadataFormatClassName; - - - /** - * The names of additional formats for encoding image metadata, - * other than the {@linkplain - * #isStandardImageMetadataFormatSupported() standard} and the - * {@linkplain #getNativeImageMetadataFormatName() native} formats, - * or <code>null</code> if this plug-in does not provide any extra - * formats. - */ - protected String[] extraImageMetadataFormatNames; - - - protected String[] extraImageMetadataFormatClassNames; - - - /** - * Constructs an <code>ImageReaderWriteSpi</code> instance, without - * specifying a number of parameters. Constructors of concrete - * subclasses must ensure that they set all inherited fields to - * meaningful values. - */ - public ImageReaderWriterSpi() - { - } - - - /** - * Constructs an <code>ImageReaderWriteSpi</code> instance, - * specifying a number of parameters. - * - * @param names the human-readable, localized names of the supported - * image formats, for example <code>[“Tagged Image File - * Format”, “Portable Network - * Graphics”]</code>. - * - * @param suffixes the file suffixes of the supported image formats, - * for example <code>[“tiff”, “tif”, - * “png”]</code>. - * - * @param MIMETypes the MIME types of the supported image formats, - * for example <code>[“image/tiff”, - * “image/png”]</code>. - * - * @param pluginClassName the fully qualified name of the class that - * implements the {@link javax.imageio.ImageReader} or {@link - * javax.imageio.ImageWriter} interface. - * - * @param supportsStandardStreamMetadataFormat whether the - * per-stream {@linkplain javax.imageio.metadata.IIOMetadata - * metadata objects} associated with this plug-in support format - * <code>“javax_imageio_1.0”</code> in their - * <code>getAsTree</code> and <code>setAsTree</code> methods. - * - * @param nativeStreamMetadataFormatName the name of the format that - * allows encoding all stream metadata without loss, or - * <code>null</code> if this plug-in does not provide a format that - * preserves all stream metadata. - * - * @param extraStreamMetadataFormatNames the names of additional - * formats for encoding stream metadata, other than the {@linkplain - * #isStandardStreamMetadataFormatSupported() standard} and the - * {@linkplain #getNativeStreamMetadataFormatName() native} formats, - * or <code>null</code> if this plug-in does not provide any extra - * formats. - * - * @param supportsStandardImageMetadataFormat whether the per-image - * {@linkplain javax.imageio.metadata.IIOMetadata metadata objects} - * associated with this plug-in support format - * <code>“javax_imageio_1.0”</code> in their - * <code>getAsTree</code> and <code>setAsTree</code> methods. - * - * @param nativeImageMetadataFormatName the name of the format that - * allows encoding all image metadata without loss, or - * <code>null</code> if this plug-in does not provide a format that - * preserves all image metadata. - * - * @param extraImageMetadataFormatNames the names of additional - * formats for encoding image metadata, other than the {@linkplain - * #isStandardImageMetadataFormatSupported() standard} and the - * {@linkplain #getNativeImageMetadataFormatName() native} formats, - * or <code>null</code> if this plug-in does not provide any extra - * formats. - * - * @throws IllegalArgumentException if <code>vendorName</code> - * or <code>version</code> is <code>null</code>. - */ - 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) - { - /* The inherited constructor will throw IllegalArgumentException - * if one of its arguments is null. - */ - super(vendorName, version); - - if (names == null || names.length == 0 || pluginClassName == null) - throw new IllegalArgumentException(); - - this.names = names; - this.suffixes = suffixes; - this.MIMETypes = MIMETypes; - this.pluginClassName = pluginClassName; - - this.supportsStandardStreamMetadataFormat - = supportsStandardStreamMetadataFormat; - - this.nativeStreamMetadataFormatName - = nativeStreamMetadataFormatName; - - this.nativeStreamMetadataFormatClassName - = nativeStreamMetadataFormatClassName; - - this.extraStreamMetadataFormatNames - = extraStreamMetadataFormatNames; - - this.extraStreamMetadataFormatClassNames - = extraStreamMetadataFormatClassNames; - - this.supportsStandardImageMetadataFormat - = supportsStandardImageMetadataFormat; - - this.nativeImageMetadataFormatName - = nativeImageMetadataFormatName; - - this.nativeImageMetadataFormatClassName - = nativeImageMetadataFormatClassName; - - this.extraImageMetadataFormatNames - = extraImageMetadataFormatNames; - - this.extraImageMetadataFormatClassNames - = extraImageMetadataFormatClassNames; - } - - - /** - * Returns the human-readable, localized names of the supported - * image formats. For example, a plug-in might return an array with - * the elements <code>[“Tagged Image File Format”, - * “Portable Network Graphics”]</code>. - */ - public String[] getFormatNames() - { - return (String[]) names.clone(); - } - - - /** - * Returns the file suffixes of the supported image formats, for - * example <code>[“tiff”, “tif”, - * “png”]</code>. - */ - public String[] getFileSuffixes() - { - return suffixes; - } - - - /** - * Returns the MIME types of the supported image formats, for - * example <code>[“image/tiff”, - * “image/png”]</code>. - * - * @return an array of MIME type strings, or <code>null</code> if - * none of the supported formats has an associated MIME type. - */ - public String[] getMIMETypes() - { - return MIMETypes; - } - - - /** - * Returns the fully qualified name of the class that implements the - * {@link javax.imageio.ImageReader} or {@link - * javax.imageio.ImageWriter} interface. - */ - public String getPluginClassName() - { - return pluginClassName; - } - - - /** - * Returns whether the per-stream {@linkplain - * javax.imageio.metadata.IIOMetadata metadata objects} associated - * with this plug-in support format - * <code>“javax_imageio_1.0”</code> in their - * <code>getAsTree</code> and <code>setAsTree</code> methods. - */ - public boolean isStandardStreamMetadataFormatSupported() - { - return supportsStandardStreamMetadataFormat; - } - - - /** - * Returns the name of the format that allows encoding all stream - * metadata without loss, or <code>null</code> if this plug-in does - * not provide a format that preserves all stream metadata. - * - * @see #getNativeImageMetadataFormatName() - */ - public String getNativeStreamMetadataFormatName() - { - return nativeStreamMetadataFormatName; - } - - - /** - * Returns the names of additional formats for encoding stream - * metadata, other than the {@linkplain - * #isStandardStreamMetadataFormatSupported() standard} and the - * {@linkplain #getNativeStreamMetadataFormatName() native} formats, - * or <code>null</code> if this plug-in does not provide any extra - * formats. - * - * @see #getExtraImageMetadataFormatNames() - */ - public String[] getExtraStreamMetadataFormatNames() - { - return extraStreamMetadataFormatNames; - } - - - /** - * Returns whether the per-image {@linkplain - * javax.imageio.metadata.IIOMetadata metadata objects} associated - * with this plug-in support format - * <code>“javax_imageio_1.0”</code> in their - * <code>getAsTree</code> and <code>setAsTree</code> methods. - */ - public boolean isStandardImageMetadataFormatSupported() - { - return supportsStandardImageMetadataFormat; - } - - - /** - * Returns the name of the format that allows encoding all image - * metadata without loss, or <code>null</code> if this plug-in does - * not provide a format that preserves all image metadata. - * - * @see #getNativeStreamMetadataFormatName() - */ - public String getNativeImageMetadataFormatName() - { - return nativeImageMetadataFormatName; - } - - - /** - * Returns the names of additional formats for encoding image - * metadata, other than the {@linkplain - * #isStandardImageMetadataFormatSupported() standard} and the - * {@linkplain #getNativeImageMetadataFormatName() native} formats, - * or <code>null</code> if this plug-in does not provide any extra - * formats. - * - * @see #getExtraStreamMetadataFormatNames() - */ - public String[] getExtraImageMetadataFormatNames() - { - return extraImageMetadataFormatNames; - } -} diff --git a/libjava/javax/imageio/spi/ImageTranscoderSpi.java b/libjava/javax/imageio/spi/ImageTranscoderSpi.java deleted file mode 100644 index 1c04ad20c88..00000000000 --- a/libjava/javax/imageio/spi/ImageTranscoderSpi.java +++ /dev/null @@ -1,84 +0,0 @@ -/* ImageTranscoderSpi.java -- Factory for image metadata transcoders. - Copyright (C) 2004, 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.spi; - -import javax.imageio.ImageTranscoder; - - -/** - * An abstract superclass for service providers that create - * {@linkplain javax.imageio.ImageTranscoder image metadata - * transcoders}. - * - * @since 1.4 - * - * @author Sascha Brawer (brawer@dandelis.ch) - */ -public abstract class ImageTranscoderSpi - extends IIOServiceProvider -{ - /** - * Constructs a service provider for image metadata transcoders, - * given no parameters. It is up to the sub-class to set {@link - * #vendorName} and {@link #version} to non-null values. - */ - protected ImageTranscoderSpi() - { - } - - - /** - * Constructs a service provider for image metadata transcoders, - * given the vendor name and a version string. - * - * @throws IllegalArgumentException if <code>vendorName</code> - * or <code>version</code> is <code>null</code>. - */ - public ImageTranscoderSpi(String vendorName, String version) - { - super(vendorName, version); - } - - - public abstract String getReaderServiceProviderName(); - - public abstract String getWriterServiceProviderName(); - - public abstract ImageTranscoder createTranscoderInstance(); -} diff --git a/libjava/javax/imageio/spi/ImageWriterSpi.java b/libjava/javax/imageio/spi/ImageWriterSpi.java deleted file mode 100644 index 3ec52c51c23..00000000000 --- a/libjava/javax/imageio/spi/ImageWriterSpi.java +++ /dev/null @@ -1,135 +0,0 @@ -/* ImageWriterSpi.java -- - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.spi; - -import java.awt.image.RenderedImage; -import java.io.IOException; - -import javax.imageio.ImageTypeSpecifier; -import javax.imageio.ImageWriter; -import javax.imageio.stream.ImageOutputStream; - -/** - * @author Michael Koch (konqueror@gmx.de) - */ -public abstract class ImageWriterSpi extends ImageReaderWriterSpi -{ - public static final Class[] STANDARD_OUTPUT_TYPE = - { ImageOutputStream.class }; - - protected Class[] outputTypes; - protected String[] readerSpiNames; - - protected ImageWriterSpi() - { - // Do nothing here. - } - - public ImageWriterSpi(String vendorName, String version, String[] names, - String[] suffixes, String[] MIMETypes, - String writerClassName, 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, writerClassName, - supportsStandardStreamMetadataFormat, nativeStreamMetadataFormatName, - nativeStreamMetadataFormatClassName, extraStreamMetadataFormatNames, - extraStreamMetadataFormatClassNames, supportsStandardImageMetadataFormat, - nativeImageMetadataFormatName, nativeImageMetadataFormatClassName, - extraImageMetadataFormatNames, extraImageMetadataFormatClassNames); - - if (writerClassName == null) - throw new IllegalArgumentException("writerClassName is null"); - - if (outputTypes == null - || outputTypes.length == 0) - throw new IllegalArgumentException("outputTypes may not be null or empty"); - - this.outputTypes = outputTypes; - this.readerSpiNames = readerSpiNames; - } - - public abstract boolean canEncodeImage(ImageTypeSpecifier type); - - public boolean canEncodeImage(RenderedImage image) - { - return canEncodeImage (new ImageTypeSpecifier(image)); - } - - public ImageWriter createWriterInstance() - throws IOException - { - return createWriterInstance(null); - } - - public abstract ImageWriter createWriterInstance(Object extension) - throws IOException; - - public String[] getImageReaderSpiNames() - { - return readerSpiNames; - } - - public Class[] getOutputTypes() - { - return outputTypes; - } - - public boolean isFormatLossless() - { - return true; - } - - public boolean isOwnWriter(ImageWriter writer) - { - if (writer == null) - throw new IllegalArgumentException("writer may not be null"); - - return pluginClassName.equals(writer.getClass().getName()); - } -} diff --git a/libjava/javax/imageio/spi/RegisterableService.java b/libjava/javax/imageio/spi/RegisterableService.java deleted file mode 100644 index ccf734e69ac..00000000000 --- a/libjava/javax/imageio/spi/RegisterableService.java +++ /dev/null @@ -1,83 +0,0 @@ -/* RegisterableService.java -- An interface for service providers. - Copyright (C) 2004, 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.spi; - - -/** - * An interface which service providers may optionally implement in - * order to get notified when they are added or removed from a {@link - * ServiceRegistry}. - * - * @since 1.4 - * - * @author Sascha Brawer (brawer@dandelis.ch) - */ -public interface RegisterableService -{ - /** - * Informs this service provider that it has been registered in a - * {@link ServiceRegistry}. If this provider gets registered as an - * implementor for several service categories, its - * <code>onRegistration</code> method will be called multiple times. - * - * @param registry the registry to which this service provider has - * been added. - * - * @param category the service category for which this provider has - * been registered as an implementor. - */ - void onRegistration(ServiceRegistry registry, Class category); - - - /** - * Informs this service provider that it has been de-registered from - * a {@link ServiceRegistry}. If this provider had been registered - * as an implementor for several service categories, its - * <code>onDeregistration</code> method will be called multiple - * times. - * - * @param registry the registry from which this service provider has - * been removed. - * - * @param category the service category for which this provider has - * been registered as an implementor. - */ - void onDeregistration(ServiceRegistry registry, Class category); -} - diff --git a/libjava/javax/imageio/spi/ServiceRegistry.java b/libjava/javax/imageio/spi/ServiceRegistry.java deleted file mode 100644 index 031b666046c..00000000000 --- a/libjava/javax/imageio/spi/ServiceRegistry.java +++ /dev/null @@ -1,961 +0,0 @@ -/* ServiceRegistry.java -- A simple registry for service providers. - Copyright (C) 2004, 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.spi; - -import gnu.classpath.ServiceFactory; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashSet; -import java.util.IdentityHashMap; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Set; - -/** - * A registry for service providers. - * - * @since 1.4 - * - * @author Michael Koch (konqueror@gmx.de) - * @author Sascha Brawer (brawer@dandelis.ch) - */ -public class ServiceRegistry -{ - // Package-private to avoid a trampoline. - /** - * The service categories of this registry. - * - * <p>Note that we expect that only very few categories will - * typically be used with a registry. The most common case will be - * one, it seems unlikely that any registry would contain more than - * five or six categories. Therefore, we intentionally avoid the - * overhead of a HashMap. - * - * @see #providers - */ - final Class[] categories; - - - /** - * The registered providers for each service category, indexed by - * the same index as the {@link #categories} array. If no provider - * is registered for a category, the array entry will be - * <code>null</code>. - * - * <p>Note that we expect that only very few providers will - * typically be registered for a category. The most common case will - * be one or two. Therefore, we intentionally avoid the overhead of - * a HashMap. - */ - private final LinkedList[] providers; - - - /** - * The ordring constaints for each service category, indexed by the - * same index as the {@link #categories} array. The constraints for - * a service category are stored as a <code>Map<Object, - * Set<Object>></code>, where the Map’s values are - * those providers that need to come after the key. If no - * constraints are imposed on the providers of a category, the array - * entry will be <code>null</code>. If no constraints have been set - * whatsoever, <code>constraints</code> will be <code>null</code>. - * - * <p>Note that we expect that only very few constraints will - * typically be imposed on a category. The most common case will - * be zero. - */ - private IdentityHashMap[] constraints; - - - /** - * Constructs a <code>ServiceRegistry</code> for the specified - * service categories. - * - * @param categories the categories to support - * - * @throws IllegalArgumentException if <code>categories</code> is - * <code>null</code>, or if its {@link Iterator#next()} method - * returns <code>null</code>. - * - * @throws ClassCastException if <code>categories</code> does not - * iterate over instances of {@link java.lang.Class}. - */ - public ServiceRegistry(Iterator categories) - { - ArrayList cats = new ArrayList(/* expected size */ 10); - - if (categories == null) - throw new IllegalArgumentException(); - - while (categories.hasNext()) - { - Class cat = (Class) categories.next(); - if (cat == null) - throw new IllegalArgumentException(); - cats.add(cat); - } - - int numCats = cats.size(); - this.categories = (Class[]) cats.toArray(new Class[numCats]); - this.providers = new LinkedList[numCats]; - } - - - /** - * Finds service providers that are implementing the specified - * Service Provider Interface. - * - * <p><b>On-demand loading:</b> Loading and initializing service - * providers is delayed as much as possible. The rationale is that - * typical clients will iterate through the set of installed service - * providers until one is found that matches some criteria (like - * supported formats, or quality of service). In such scenarios, it - * might make sense to install only the frequently needed service - * providers on the local machine. More exotic providers can be put - * onto a server; the server will only be contacted when no suitable - * service could be found locally.</p> - * - * <p><b>Security considerations:</b> Any loaded service providers - * are loaded through the specified ClassLoader, or the system - * ClassLoader if <code>classLoader</code> is - * <code>null</code>. When <code>lookupProviders</code> is called, - * the current {@link java.security.AccessControlContext} gets - * recorded. This captured security context will determine the - * permissions when services get loaded via the <code>next()</code> - * method of the returned <code>Iterator</code>.</p> - * - * @param spi the service provider interface which must be - * implemented by any loaded service providers. - * - * @param loader the class loader that will be used to load the - * service providers, or <code>null</code> for the system class - * loader. For using the context class loader, see {@link - * #lookupProviders(Class)}. - * - * @return an iterator over instances of <code>spi</code>. - * - * @throws IllegalArgumentException if <code>spi</code> is - * <code>null</code>. - */ - public static Iterator lookupProviders(Class spi, - ClassLoader loader) - { - return ServiceFactory.lookupProviders(spi, loader); - } - - - /** - * Finds service providers that are implementing the specified - * Service Provider Interface, using the context class loader - * for loading providers. - * - * @param spi the service provider interface which must be - * implemented by any loaded service providers. - * - * @return an iterator over instances of <code>spi</code>. - * - * @throws IllegalArgumentException if <code>spi</code> is - * <code>null</code>. - * - * @see #lookupProviders(Class, ClassLoader) - */ - public static Iterator lookupProviders(Class spi) - { - return ServiceFactory.lookupProviders(spi); - } - - - /** - * Returns an iterator over all service categories. - * - * @return an unmodifiable {@link - * java.util.Iterator}<{@link java.lang.Class}>. - */ - public Iterator getCategories() - { - return new Iterator() - { - int index = -1; - - public boolean hasNext() - { - return index < categories.length - 1; - } - - public Object next() - { - if (!hasNext()) - throw new NoSuchElementException(); - - return categories[++index]; - } - - public void remove() - { - throw new UnsupportedOperationException(); - } - }; - } - - - /** - * Registers a provider for a service category which is specified by - * the class-internal category ID. - * - * @param provider the service provider to be registered. - * - * @param cat the service category, which is identified by an index - * into the {@link #categories} array. - * - * @return <code>true</code> if <code>provider</code> is the first - * provider that gets registered for the specified service category; - * <code>false</code> if other providers have already been - * registered for the same servide category. - * - * @throws IllegalArgumentException if <code>provider</code> is - * <code>null</code>. - * - * @throws ClassCastException if <code>provider</code> does not - * implement the specified service provider interface. - */ - private synchronized boolean registerServiceProvider(Object provider, - int cat) - { - LinkedList provs; - boolean result; - Class category; - - if (provider == null) - throw new IllegalArgumentException(); - - category = categories[cat]; - if (!category.isInstance(provider)) - throw new ClassCastException(category.getName()); - - provs = providers[cat]; - if (provs == null) - { - result = true; - provs = providers[cat] = new LinkedList(); - } - else - result = false; - - provs.add(provider); - if (provider instanceof RegisterableService) - ((RegisterableService) provider).onRegistration(this, category); - - return result; - } - - - /** - * Registers a provider for the specified service category. - * - * <p>If <code>provider</code> implements the {@link - * RegisterableService} interface, its {@link - * RegisterableService#onRegistration onRegistration} method is - * invoked in order to inform the provider about the addition to - * this registry. - * - * @param provider the service provider to be registered. - * - * @param category the service category under which - * <code>provider</code> shall be registered. - * - * @return <code>true</code> if <code>provider</code> is the first - * provider that gets registered for the specified service category; - * <code>false</code> if other providers have already been - * registered for the same servide category. - * - * @throws IllegalArgumentException if <code>provider</code> is - * <code>null</code>, or if <code>category</code> is not among the - * categories passed to the {@linkplain #ServiceRegistry(Iterator) - * constructor} of this ServiceRegistry. - * - * @throws ClassCastException if <code>provider</code> does not - * implement <code>category</code>. - */ - public synchronized boolean registerServiceProvider(Object provider, - Class category) - { - for (int i = 0; i < categories.length; i++) - if (categories[i] == category) - return registerServiceProvider(provider, i); - throw new IllegalArgumentException(); - } - - - /** - * Registers a provider under all service categories it - * implements. - * - * <p>If <code>provider</code> implements the {@link - * RegisterableService} interface, its {@link - * RegisterableService#onRegistration onRegistration} method is - * invoked in order to inform the provider about the addition to - * this registry. If <code>provider</code> implements several - * service categories, <code>onRegistration</code> gets called - * multiple times. - * - * @param provider the service provider to be registered. - * - * @throws IllegalArgumentException if <code>provider</code> is - * <code>null</code>, or if <code>provider</code> does not implement - * any of the service categories passed to the {@linkplain - * #ServiceRegistry(Iterator) constructor} of this ServiceRegistry. - */ - public synchronized void registerServiceProvider(Object provider) - { - boolean ok = false; - - if (provider == null) - throw new IllegalArgumentException(); - - for (int i = 0; i < categories.length; i++) - if (categories[i].isInstance(provider)) - { - ok = true; - registerServiceProvider(provider, i); - } - - if (!ok) - throw new IllegalArgumentException(); - } - - - /** - * Registers a number of providers under all service categories they - * implement. - * - * <p>If a provider implements the {@link RegisterableService} - * interface, its {@link RegisterableService#onRegistration - * onRegistration} method is invoked in order to inform the provider - * about the addition to this registry. If <code>provider</code> - * implements several service categories, - * <code>onRegistration</code> gets called multiple times. - * - * @throws IllegalArgumentException if <code>providers</code> is - * <code>null</code>, if any iterated provider is <code>null</code>, - * or if some iterated provider does not implement any of the - * service categories passed to the {@linkplain - * #ServiceRegistry(Iterator) constructor} of this - * <code>ServiceRegistry</code>. - */ - public synchronized void registerServiceProviders(Iterator providers) - { - if (providers == null) - throw new IllegalArgumentException(); - - while (providers.hasNext()) - registerServiceProvider(providers.next()); - } - - - /** - * De-registers a provider for a service category which is specified - * by the class-internal category ID. - * - * @param provider the service provider to be registered. - * - * @param cat the service category, which is identified by an index - * into the {@link #categories} array. - * - * @return <code>true</code> if <code>provider</code> was previously - * registered for the specified service category; <code>false</code> - * if if the provider had not been registered. - * - * @throws IllegalArgumentException if <code>provider</code> is - * <code>null</code>. - * - * @throws ClassCastException if <code>provider</code> does not - * implement the specified service provider interface. - */ - private synchronized boolean deregisterServiceProvider(Object provider, - int cat) - { - LinkedList provs; - boolean result; - Class category; - - if (provider == null) - throw new IllegalArgumentException(); - - category = categories[cat]; - if (!category.isInstance(provider)) - throw new ClassCastException(category.getName()); - - provs = providers[cat]; - if (provs == null) - return false; - - result = provs.remove(provider); - if (provs.isEmpty()) - providers[cat] = null; - - if (result && (provider instanceof RegisterableService)) - ((RegisterableService) provider).onDeregistration(this, category); - - return result; - } - - - /** - * De-registers a provider for the specified service category. - * - * <p>If <code>provider</code> implements the {@link - * RegisterableService} interface, its {@link - * RegisterableService#onDeregistration onDeregistration} method is - * invoked in order to inform the provider about the removal from - * this registry. - * - * @param provider the service provider to be de-registered. - * - * @param category the service category from which - * <code>provider</code> shall be de-registered. - * - * @return <code>true</code> if <code>provider</code> was previously - * registered for the specified service category; <code>false</code> - * if if the provider had not been registered. - * - * @throws IllegalArgumentException if <code>provider</code> is - * <code>null</code>, or if <code>category</code> is not among the - * categories passed to the {@linkplain #ServiceRegistry(Iterator) - * constructor} of this ServiceRegistry. - * - * @throws ClassCastException if <code>provider</code> does not - * implement <code>category</code>. - */ - public synchronized boolean deregisterServiceProvider(Object provider, - Class category) - { - for (int i = 0; i < categories.length; i++) - if (categories[i] == category) - return deregisterServiceProvider(provider, i); - throw new IllegalArgumentException(); - } - - - /** - * De-registers a provider from all service categories it - * implements. - * - * <p>If <code>provider</code> implements the {@link - * RegisterableService} interface, its {@link - * RegisterableService#onDeregistration onDeregistration} method is - * invoked in order to inform the provider about the removal from - * this registry. If <code>provider</code> implements several - * service categories, <code>onDeregistration</code> gets called - * multiple times.</p> - * - * @param provider the service provider to be de-registered. - * - * @throws IllegalArgumentException if <code>provider</code> is - * <code>null</code>, or if <code>provider</code> does not implement - * any of the service categories passed to the {@linkplain - * #ServiceRegistry(Iterator) constructor} of this - * <code>ServiceRegistry</code>. - */ - public synchronized void deregisterServiceProvider(Object provider) - { - boolean ok = false; - - if (provider == null) - throw new IllegalArgumentException(); - - for (int i = 0; i < categories.length; i++) - if (categories[i].isInstance(provider)) - { - ok = true; - deregisterServiceProvider(provider, i); - } - - if (!ok) - throw new IllegalArgumentException(); - } - - - /** - * De-registers all providers which have been registered for the - * specified service category. - * - * <p>If a provider implements the {@link RegisterableService} - * interface, its {@link RegisterableService#onDeregistration - * onDeregistration} method is invoked in order to inform the - * provider about the removal from this registry. If the provider - * implements several service categories, - * <code>onDeregistration</code> gets called multiple times. - * - * @param category the category whose registered providers will be - * de-registered. - * - * @throws IllegalArgumentException if <code>category</code> is not - * among the categories passed to the {@linkplain - * #ServiceRegistry(Iterator) constructor} of this - * <code>ServiceRegistry</code>. - */ - public synchronized void deregisterAll(Class category) - { - boolean ok = false; - - for (int i = 0; i < categories.length; i++) - { - if (categories[i] != category) - continue; - - ok = true; - while (providers[i] != null) - deregisterServiceProvider(providers[i].get(0), i); - } - - if (!ok) - throw new IllegalArgumentException(); - } - - - /** - * De-registers all service providers. - * - * <p>If a provider implements the {@link RegisterableService} - * interface, its {@link RegisterableService#onDeregistration - * onDeregistration} method is invoked in order to inform the - * provider about the removal from this registry. If the provider - * implements several service categories, - * <code>onDeregistration</code> gets called multiple times. - */ - public synchronized void deregisterAll() - { - for (int i = 0; i < categories.length; i++) - while (providers[i] != null) - deregisterServiceProvider(providers[i].get(0), i); - } - - - /** - * Called by the Virtual Machine when it detects that this - * <code>ServiceRegistry</code> has become garbage. De-registers all - * service providers, which will cause those that implement {@link - * RegisterableService} to receive a {@link - * RegisterableService#onDeregistration onDeregistration} - * notification. - */ - public void finalize() - throws Throwable - { - super.finalize(); - deregisterAll(); - } - - - /** - * Determines whether a provider has been registered with this - * registry. - * - * @return <code>true</code> if <code>provider</code> has been - * registered under any service category; <code>false</code> if - * it is not registered. - * - * @throws IllegalArgumentException if <code>provider</code> is - * <code>null</code>. - */ - public synchronized boolean contains(Object provider) - { - if (provider == null) - throw new IllegalArgumentException(); - - // Note that contains is rather unlikely to be ever called, - // so it would be wasteful to keep a special data structure - // (such as a HashSet) for making it a fast operation. - for (int i = 0; i < providers.length; i++) - { - // If provider does not implement categories[i], - // it would not have been possible to register it there. - // In that case, it would be pointless to look there. - if (!categories[i].isInstance(provider)) - continue; - - // But if the list of registered providers contains provider, - // we have found it. - LinkedList p = providers[i]; - if (p != null && p.contains(provider)) - return true; - } - - return false; - } - - - /** - * Returns the index in {@link #categories} occupied by the - * specified service category. - * - * @throws IllegalArgumentException if <code>category</code> is not - * among the categories passed to the {@linkplain - * #ServiceRegistry(Iterator) constructor} of this ServiceRegistry. - */ - private int getCategoryID(Class category) - { - for (int i = 0; i < categories.length; i++) - if (categories[i] == category) - return i; - - throw new IllegalArgumentException(); - } - - - /** - * Retrieves all providers that have been registered for the - * specified service category. - * - * @param category the service category whose providers are - * to be retrieved. - * - * @param useOrdering <code>true</code> in order to retrieve the - * providers in an order imposed by the {@linkplain #setOrdering - * ordering constraints}; <code>false</code> in order to retrieve - * the providers in any order. - * - * @throws IllegalArgumentException if <code>category</code> is not - * among the categories passed to the {@linkplain - * #ServiceRegistry(Iterator) constructor} of this - * <code>ServiceRegistry</code>. - * - * @see #getServiceProviders(Class, Filter, boolean) - */ - public Iterator getServiceProviders(Class category, boolean useOrdering) - { - return getServiceProviders(category, null, useOrdering); - } - - - /** - * Retrieves all providers that have been registered for the - * specified service category and that satisfy the criteria - * of a custom filter. - * - * @param category the service category whose providers are - * to be retrieved. - * - * @param filter a custom filter, or <code>null</code> to - * retrieve all registered providers for the specified - * category. - * - * @param useOrdering <code>true</code> in order to retrieve the - * providers in an order imposed by the {@linkplain #setOrdering - * ordering constraints}; <code>false</code> in order to retrieve - * the providers in any order. - * - * @throws IllegalArgumentException if <code>category</code> is not - * among the categories passed to the {@linkplain - * #ServiceRegistry(Iterator) constructor} of this - * <code>ServiceRegistry</code>. - */ - public synchronized Iterator getServiceProviders(Class category, - Filter filter, - boolean useOrdering) - { - int catid; - LinkedList provs; - ArrayList result; - - catid = getCategoryID(category); - provs = providers[catid]; - if (provs == null) - return Collections.EMPTY_LIST.iterator(); - - result = new ArrayList(provs.size()); - for (Iterator iter = provs.iterator(); iter.hasNext();) - { - Object provider = iter.next(); - if (filter == null || filter.filter(provider)) - result.add(provider); - } - - // If we are supposed to obey ordering constraints, and - // if any constraints have been imposed on the specified - // service category, sort the result. - if (useOrdering && constraints != null) - { - final Map cons = constraints[catid]; - if (cons != null) - Collections.sort(result, new Comparator() - { - public int compare(Object o1, Object o2) - { - Set s; - - if (o1 == o2) - return 0; - - s = (Set) cons.get(o1); - if (s != null && s.contains(o2)) - return -1; // o1 < o2 - - s = (Set) cons.get(o2); - if (s != null && s.contains(o1)) - return 1; // o1 > o2 - - return 0; // o1 == o2 - } - }); - } - - return result.iterator(); - } - - - /** - * Returns one of the service providers that is a subclass of the - * specified class. - * - * @param providerClass a class to search for. - */ - public synchronized Object getServiceProviderByClass(Class providerClass) - { - if (providerClass == null) - throw new IllegalArgumentException(); - - // Note that the method getServiceProviderByClass is rather - // unlikely to be ever called, so it would be wasteful to keep a - // special data structure for making it a fast operation. - for (int cat = 0; cat < categories.length; cat++) - { - if (!categories[cat].isAssignableFrom(providerClass)) - continue; - - LinkedList provs = providers[cat]; - if (provs == null) - continue; - - for (Iterator iter = provs.iterator(); iter.hasNext();) - { - Object provider = iter.next(); - if (providerClass.isInstance(provider)) - return provider; - } - } - - return null; - } - - - /** - * Adds an ordering constraint on service providers. - * - * @param category the service category to which an ordering - * constraint is to be added. - * - * @param first the provider which is supposed to come before - * <code>second</code>. - * - * @param second the provider which is supposed to come after - * <code>first</code>. - * - * @throws IllegalArgumentException if <code>first</code> and - * <code>second</code> are referring to the same object, or if one - * of them is <code>null</code>. - * - * @see #unsetOrdering - * @see #getServiceProviders(Class, Filter, boolean) - */ - public synchronized boolean setOrdering(Class category, - Object firstProvider, - Object secondProvider) - { - return addConstraint(getCategoryID(category), firstProvider, - secondProvider); - } - - - /** - * Removes an ordering constraint on service providers. - * - * @param category the service category from which an ordering - * constraint is to be removed. - * - * @param first the provider which is supposed to come before - * <code>second</code>. - * - * @param second the provider which is supposed to come after - * <code>first</code>. - * - * @throws IllegalArgumentException if <code>first</code> and - * <code>second</code> are referring to the same object, or if one - * of them is <code>null</code>. - * - * @see #setOrdering - */ - public synchronized boolean unsetOrdering(Class category, - Object firstProvider, - Object secondProvider) - { - return removeConstraint(getCategoryID(category), - firstProvider, secondProvider); - } - - - /** - * Adds an ordering constraint on service providers. - * - * @param catid the service category ID, which is the - * category’s index into the {@link #categories} array. - * - * @param first the provider which is supposed to come before - * <code>second</code>. - * - * @param second the provider which is supposed to come after - * <code>first</code>. - * - * @throws IllegalArgumentException if <code>first</code> and - * <code>second</code> are referring to the same object, or if one - * of them is <code>null</code>. - */ - private boolean addConstraint(int catid, Object first, Object second) - { - Set s; - IdentityHashMap cons; - - // Also checks argument validity. - removeConstraint(catid, second, first); - - if (constraints == null) - constraints = new IdentityHashMap[categories.length]; - cons = constraints[catid]; - if (cons == null) - cons = constraints[catid] = new IdentityHashMap(); - - s = (Set) cons.get(first); - if (s == null) - cons.put(first, s = new HashSet()); - return s.add(second); - } - - - /** - * Removes an ordering constraint on service providers. - * - * @param catid the service category ID, which is the - * category’s index into the {@link #categories} array. - * - * @param first the provider which is supposed to come before - * <code>second</code>. - * - * @param second the provider which is supposed to come after - * <code>first</code>. - * - * @throws IllegalArgumentException if <code>first</code> and - * <code>second</code> are referring to the same object, or if one - * of them is <code>null</code>. - */ - private boolean removeConstraint(int catid, Object first, Object second) - { - Collection s; - IdentityHashMap cons; - - if (first == null || second == null || first == second) - throw new IllegalArgumentException(); - - if (constraints == null) - return false; - - cons = constraints[catid]; - if (cons == null) - return false; - - s = (Collection) cons.get(first); - if (s == null) - return false; - - if (!s.remove(second)) - return false; - - // If we removed the last constraint for a service category, - // we can get free some memory. - if (cons.isEmpty()) - { - constraints[catid] = null; - boolean anyConstraints = false; - for (int i = 0; i < constraints.length; i++) - { - if (constraints[i] != null) - { - anyConstraints = true; - break; - } - } - if (!anyConstraints) - constraints = null; - } - - return true; - } - - - /** - * A filter for selecting service providers that match custom - * criteria. - * - * @see ServiceRegistry#getServiceProviders(Class, Filter, - * boolean) - * - * @since 1.4 - * - * @author Michael Koch (konqueror@gmx.de) - * @author Sascha Brawer (brawer@dandelis.ch) - */ - public static interface Filter - { - /** - * Checks whether the specified service provider matches the - * constraints of this Filter. - * - * @param provider the service provider in question. - * - * @return <code>true</code> if <code>provider</code> matches the - * criteria; <code>false</code> if it does not match. - */ - boolean filter(Object provider); - }; -} - diff --git a/libjava/javax/imageio/stream/FileCacheImageInputStream.java b/libjava/javax/imageio/stream/FileCacheImageInputStream.java deleted file mode 100644 index 40fed63af01..00000000000 --- a/libjava/javax/imageio/stream/FileCacheImageInputStream.java +++ /dev/null @@ -1,109 +0,0 @@ -/* FileCacheImageInputStream.java -- - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.stream; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; - -/** - * @author Michael Koch (konqueror@gmx.de) - */ -public class FileCacheImageInputStream extends ImageInputStreamImpl -{ - private InputStream stream; - private File cacheDir; - - public FileCacheImageInputStream(InputStream stream, File cacheDir) - throws IOException - { - super(); - this.stream = stream; - // FIXME: We do not support caching yet. - this.cacheDir = cacheDir; - } - - public void close() - throws IOException - { - if (stream != null) - { - stream.close(); - stream = null; - } - } - - private void checkStreamClosed() - throws IOException - { - if (stream == null) - throw new IOException("stream closed"); - } - - public boolean isCached() - { - return true; - } - - public boolean isCachedFile() - { - return true; - } - - public boolean isCachedMemory() - { - return false; - } - - public int read() - throws IOException - { - checkStreamClosed(); - setBitOffset(0); - return stream.read(); - } - - public int read(byte[] data, int offset, int len) - throws IOException - { - checkStreamClosed(); - setBitOffset(0); - return stream.read(data, offset, len); - } -} diff --git a/libjava/javax/imageio/stream/FileCacheImageOutputStream.java b/libjava/javax/imageio/stream/FileCacheImageOutputStream.java deleted file mode 100644 index 16cd0a7a95e..00000000000 --- a/libjava/javax/imageio/stream/FileCacheImageOutputStream.java +++ /dev/null @@ -1,123 +0,0 @@ -/* FileCacheImageOutputStream.java -- - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.stream; - -import java.io.File; -import java.io.IOException; -import java.io.OutputStream; - -/** - * @author Michael Koch (konqueror@gmx.de) - */ -public class FileCacheImageOutputStream extends ImageOutputStreamImpl -{ - private OutputStream stream; - private File cacheDir; - - public FileCacheImageOutputStream(OutputStream stream, File cacheDir) - throws IOException - { - super(); - this.stream = stream; - // FIXME: We do not support caching yet. - this.cacheDir = cacheDir; - } - - public void close() - throws IOException - { - if (stream != null) - { - stream.close(); - stream = null; - } - } - - private void checkStreamClosed() - throws IOException - { - if (stream == null) - throw new IOException("stream closed"); - } - - public boolean isCached() - { - return true; - } - - public boolean isCachedFile() - { - return true; - } - - public boolean isCachedMemory() - { - return false; - } - - public int read() - throws IOException - { - // FIXME: Implement me. - throw new Error("not implemented"); - } - - public int read(byte[] data, int offset, int len) - throws IOException - { - // FIXME: Implement me. - throw new Error("not implemented"); - } - - public void write(byte[] data, int offset, int len) - throws IOException - { - checkStreamClosed(); - // FIXME: Flush pending bits. - stream.write(data, offset, len); - } - - public void write(int value) - throws IOException - { - checkStreamClosed(); - // FIXME: Flush pending bits. - stream.write(value); - } -} diff --git a/libjava/javax/imageio/stream/FileImageInputStream.java b/libjava/javax/imageio/stream/FileImageInputStream.java deleted file mode 100644 index 4fa1ac8a3dc..00000000000 --- a/libjava/javax/imageio/stream/FileImageInputStream.java +++ /dev/null @@ -1,108 +0,0 @@ -/* FileImageInputStream.java -- - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.stream; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.RandomAccessFile; - -/** - * @author Michael Koch (konqueror@gmx.de) - */ -public class FileImageInputStream extends ImageInputStreamImpl -{ - private RandomAccessFile file; - - public FileImageInputStream(File file) - throws FileNotFoundException, IOException - { - if (file == null) - throw new IllegalArgumentException ("file may not be null"); - - this.file = new RandomAccessFile(file, "r"); - } - - public FileImageInputStream(RandomAccessFile file) - { - if (file == null) - throw new IllegalArgumentException ("file may not be null"); - - this.file = file; - } - - public void close() - throws IOException - { - file.close(); - } - - public long length() - { - try - { - return file.length(); - } - catch (IOException e) - { - return -1L; - } - } - - public int read() - throws IOException - { - setBitOffset(0); - return file.read(); - } - - public int read(byte[] data, int offset, int len) - throws IOException - { - setBitOffset(0); - return file.read(data, offset, len); - } - - public void seek(long position) - throws IOException - { - super.seek(position); - file.seek(position); - } -} diff --git a/libjava/javax/imageio/stream/FileImageOutputStream.java b/libjava/javax/imageio/stream/FileImageOutputStream.java deleted file mode 100644 index e1ce5c25eec..00000000000 --- a/libjava/javax/imageio/stream/FileImageOutputStream.java +++ /dev/null @@ -1,133 +0,0 @@ -/* FileImageOutputStream.java -- - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.stream; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.RandomAccessFile; - -/** - * @author Michael Koch (konqueror@gmx.de) - */ -public class FileImageOutputStream extends ImageOutputStreamImpl -{ - private RandomAccessFile file; - - public FileImageOutputStream(File file) - throws FileNotFoundException, IOException - { - if (file == null) - throw new IllegalArgumentException("file may not be null"); - - // Do security check. - file.canRead(); - - this.file = new RandomAccessFile(file, "r"); - } - - public FileImageOutputStream(RandomAccessFile file) - { - if (file == null) - throw new IllegalArgumentException("file may not be null"); - - this.file = file; - } - - public void close() - throws IOException - { - file.close(); - } - - public long length() - { - try - { - return file.length(); - } - catch (IOException e) - { - return -1L; - } - } - - public int read() - throws IOException - { - checkClosed(); - - setBitOffset(0); - return file.read(); - } - - public int read(byte[] data, int offset, int len) - throws IOException - { - checkClosed(); - - setBitOffset(0); - return file.read(data, offset, len); - } - - public void seek(long position) - throws IOException - { - super.seek(position); - file.seek(position); - } - - public void write(byte[] data, int offset, int len) - throws IOException - { - checkClosed(); - - flushBits(); - file.write(data, offset, len); - } - - public void write(int value) - throws IOException - { - checkClosed(); - - // FIXME: Flush pending bits. - file.write(value); - } -} diff --git a/libjava/javax/imageio/stream/IIOByteBuffer.java b/libjava/javax/imageio/stream/IIOByteBuffer.java deleted file mode 100644 index f783653a78b..00000000000 --- a/libjava/javax/imageio/stream/IIOByteBuffer.java +++ /dev/null @@ -1,94 +0,0 @@ -/* IIOByteBuffer.java - Copyright (C) 2004, 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.stream; - -/** - * A data structure for holding a reference to a byte array, an index - * into that array, and a number of bytes, that can be passed to one - * specific variant of the {@link - * javax.imageio.stream.ImageInputStream#readBytes(IIOByteBuffer, int) - * readBytes} method. - * - * @since 1.4 - * - * @author Sascha Brawer (brawer@dandelis.ch) - */ -public class IIOByteBuffer -{ - private byte[] data; - private int offset; - private int length; - - public IIOByteBuffer(byte[] data, int offset, int length) - { - this.data = data; - this.offset = offset; - this.length = length; - } - - public byte[] getData() - { - return data; - } - - public void setData(byte[] data) - { - this.data = data; - } - - public int getOffset() - { - return offset; - } - - public void setOffset(int offset) - { - this.offset = offset; - } - - public int getLength() - { - return length; - } - - public void setLength(int length) - { - this.length = length; - } -} diff --git a/libjava/javax/imageio/stream/ImageInputStream.java b/libjava/javax/imageio/stream/ImageInputStream.java deleted file mode 100644 index ec39fd3294e..00000000000 --- a/libjava/javax/imageio/stream/ImageInputStream.java +++ /dev/null @@ -1,650 +0,0 @@ -/* ImageInputStream.java - Copyright (C) 2004, 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.stream; - -import java.io.DataInput; -import java.io.IOException; -import java.nio.ByteOrder; - - -/** - * An input stream for use by {@link javax.imageio.ImageReader - * ImageReaders}. - * - * @since 1.4 - * - * @author Sascha Brawer (brawer@dandelis.ch) - */ -public interface ImageInputStream - extends DataInput -{ - void setByteOrder(ByteOrder order); - - ByteOrder getByteOrder(); - - int read() - throws IOException; - - int read(byte[] b) - throws IOException; - - int read(byte[] b, int offset, int length) - throws IOException; - - - /** - * Reads up to a specified number of bytes, and modifies a - * {@link IIOByteBuffer} to hold the read data. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before any data is read. - * - * @param buf an <code>IIOByteBuffer</code> that will hold the read - * data. - * - * @param numBytes the maximum number of bytes to read. - * - * @throws IndexOutOfBoundsException if <code>numBytes</code> is - * negative. - * - * @throws NullPointerException if <code>buf</code> is - * <code>null</code>. - * - * @throws IOException if some general problem happens with - * accessing data. - */ - void readBytes(IIOByteBuffer buf, int numBytes) - throws IOException; - - - /** - * Reads a byte and checks whether or not its value is zero. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before the byte is read. - * - * @throws EOFException if the input stream is at its end. - * - * @throws IOException if some general problem happens with - * accessing data. - * - * @see #readBit() - * @see #readByte() - * @see #readFully(byte[], int, int) - */ - boolean readBoolean() - throws IOException; - - - /** - * Reads a signed byte. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before any data is read. - * - * @throws EOFException if the input stream is at its end. - * - * @throws IOException if some general problem happens with - * accessing data. - * - * @see #readUnsignedByte() - * @see #readFully(byte[], int, int) - */ - byte readByte() - throws IOException; - - - /** - * Reads an unsigned byte. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before any data is read. - * - * @throws EOFException if the input stream is at its end. - * - * @throws IOException if some general problem happens with - * accessing data. - * - * @see #readByte() - * @see #readFully(byte[], int, int) - */ - int readUnsignedByte() - throws IOException; - - - /** - * Reads an signed 16-bit integer. If necessary, the value gets - * converted from the stream’s {@linkplain #getByteOrder() - * current byte order}. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before any data is read. - * - * @throws EOFException if the input stream ends before all two - * bytes were read. - * - * @throws IOException if some general problem happens with - * accessing data. - * - * @see #readUnsignedShort() - * @see #readChar() - * @see #readFully(short[], int, int) - */ - short readShort() - throws IOException; - - - /** - * Reads an unsigned 16-bit integer. If necessary, the value gets - * converted from the stream’s {@linkplain #getByteOrder() - * current byte order}. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before any data is read. - * - * <p>This method does the same as {@link #readChar()}. - * - * @throws EOFException if the input stream ends before all two - * bytes were read. - * - * @throws IOException if some general problem happens with - * accessing data. - * - * @see #readShort() - * @see #readChar() - * @see #readFully(char[], int, int) - */ - int readUnsignedShort() - throws IOException; - - - /** - * Reads an unsigned 16-bit integer. If necessary, the value gets - * converted from the stream’s {@linkplain #getByteOrder() - * current byte order}. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before any data is read. - * - * <p>This method does the same as {@link #readUnsignedShort()}. - * - * @throws EOFException if the input stream ends before all two - * bytes were read. - * - * @throws IOException if some general problem happens with - * accessing data. - * - * @see #readFully(char[], int, int) - */ - char readChar() - throws IOException; - - - /** - * Reads a signed 32-bit integer. If necessary, the value gets - * converted from the stream’s {@linkplain #getByteOrder() - * current byte order}. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before any data is read. - * - * @throws EOFException if the input stream ends before all four - * bytes were read. - * - * @throws IOException if some general problem happens with - * accessing data. - * - * @see #readUnsignedInt() - * @see #readFully(int[], int, int) - */ - int readInt() - throws IOException; - - - /** - * Reads an unsigned 32-bit integer. If necessary, the value gets - * converted from the stream’s {@linkplain #getByteOrder() - * current byte order}. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before any data is read. - * - * @throws EOFException if the input stream ends before all four - * bytes were read. - * - * @throws IOException if some general problem happens with - * accessing data. - * - * @see #readInt() - * @see #readFully(int[], int, int) - */ - long readUnsignedInt() - throws IOException; - - - /** - * Reads a signed 64-bit integer. If necessary, the value gets - * converted from the stream’s {@linkplain #getByteOrder() - * current byte order}. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before any data is read. - * - * @throws EOFException if the input stream ends before all eight - * bytes were read. - * - * @throws IOException if some general problem happens with - * accessing data. - * - * @see #readFully(long[], int, int) - */ - long readLong() - throws IOException; - - - /** - * Reads an IEEE 32-bit single-precision floating point number. If - * necessary, the value gets converted from the stream’s - * {@linkplain #getByteOrder() current byte order}. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before any data is read. - * - * @throws EOFException if the input stream ends before all four - * bytes were read. - * - * @throws IOException if some general problem happens with - * accessing data. - * - * @see #readFully(float[], int, int) - */ - float readFloat() - throws IOException; - - - /** - * Reads an IEEE 64-bit double-precision floating point number. If - * necessary, the value gets converted from the stream’s - * {@linkplain #getByteOrder() current byte order}. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before any data is read. - * - * @throws EOFException if the input stream ends before all eight - * bytes were read. - * - * @throws IOException if some general problem happens with - * accessing data. - * - * @see #readFully(double[], int, int) - */ - double readDouble() - throws IOException; - - String readLine() - throws IOException; - - String readUTF() - throws IOException; - - - /** - * Reads a sequence of signed 8-bit integers into a - * <code>byte[]</code> array. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before any data is read. - * - * @param b an array for storing the read values. - * - * @param offset the index of the first element in <code>b</code> - * that will hold read data. - * - * @param numBytes the number of bytes to read. - * - * @throws IndexOutOfBoundsException if <code>offset</code> or - * <code>numBytes</code> is negative, or if <code>offset + - * numBytes</code> exceeds <code>b.length</code>. - * - * @throws NullPointerException if <code>b</code> is - * <code>null</code>. - * - * @throws EOFException if the input stream ends before all content - * was read. - * - * @throws IOException if some general problem happens with - * accessing data. - * - * @see #readByte() - */ - void readFully(byte[] b, int offset, int numBytes) - throws IOException; - - - /** - * Reads a sequence of signed 8-bit integers into a - * <code>byte[]</code> array. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before any data is read. - * - * @param b an array for storing the read values. - * - * @throws NullPointerException if <code>b</code> is - * <code>null</code>. - * - * @throws EOFException if the input stream ends before all content - * was read. - * - * @throws IOException if some general problem happens with - * accessing data. - * - * @see #readByte() - * @see #readFully(byte[], int, int) - */ - void readFully(byte[] b) - throws IOException; - - - /** - * Reads a sequence of signed 16-bit integers into a - * <code>short[]</code> array. If necessary, values are converted - * from the stream’s {@linkplain #getByteOrder() current byte - * order}. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before any data is read. - * - * @param s an array for storing the read values. - * - * @param offset the index of the first element in <code>s</code> - * that will hold read data. - * - * @param numShorts the number of signed 16-bit integers to read - * (which is one half of the number of bytes). - * - * @throws IndexOutOfBoundsException if <code>offset</code> or - * <code>numShorts</code> is negative, or if <code>offset + - * numShorts</code> exceeds <code>s.length</code>. - * - * @throws NullPointerException if <code>s</code> is - * <code>null</code>. - * - * @throws EOFException if the input stream ends before all content - * was read. - * - * @throws IOException if some general problem happens with - * accessing data. - * - * @see #readShort() - */ - void readFully(short[] s, int offset, int numShorts) - throws IOException; - - - /** - * Reads a sequence of unsigned 16-bit integers into a - * <code>char[]</code> array. If necessary, values are converted - * from the stream’s {@linkplain #getByteOrder() current byte - * order}. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before any data is read. - * - * @param c an array for storing the read values. - * - * @param offset the index of the first element in <code>c</code> - * that will hold read data. - * - * @param numChars the number of unsigned 16-bit integers to read - * (which is one half of the number of bytes). - * - * @throws IndexOutOfBoundsException if <code>offset</code> or - * <code>numChars</code> is negative, or if <code>offset + - * numChars</code> exceeds <code>c.length</code>. - * - * @throws NullPointerException if <code>c</code> is - * <code>null</code>. - * - * @throws EOFException if the input stream ends before all content - * was read. - * - * @throws IOException if some general problem happens with - * accessing data. - * - * @see #readChar() - */ - void readFully(char[] c, int offset, int numChars) - throws IOException; - - - /** - * Reads a sequence of signed 32-bit integers into a - * <code>long[]</code> array. If necessary, values are converted - * from the stream’s {@linkplain #getByteOrder() current byte - * order}. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before any data is read. - * - * @param i an array for storing the read values. - * - * @param offset the index of the first element in <code>i</code> - * that will hold read data. - * - * @param numLongs the number of signed 32-bit integers to read - * (which is one fourth of the number of bytes). - * - * @throws IndexOutOfBoundsException if <code>offset</code> or - * <code>numInts</code> is negative, or if <code>offset + - * numInts</code> exceeds <code>i.length</code>. - * - * @throws NullPointerException if <code>i</code> is - * <code>null</code>. - * - * @throws EOFException if the input stream ends before all content - * was read. - * - * @throws IOException if some general problem happens with - * accessing data. - * - * @see #readInt() - */ - void readFully(int[] i, int offset, int numInts) - throws IOException; - - - /** - * Reads a sequence of signed 64-bit integers into a - * <code>long[]</code> array. If necessary, values are converted - * from the stream’s {@linkplain #getByteOrder() current byte - * order}. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before any data is read. - * - * @param l an array for storing the read values. - * - * @param offset the index of the first element in <code>l</code> - * that will hold read data. - * - * @param numLongs the number of signed 64-bit integers to read - * (which is one eight of the number of bytes). - * - * @throws IndexOutOfBoundsException if <code>offset</code> or - * <code>numLongs</code> is negative, or if <code>offset + - * numLongs</code> exceeds <code>l.length</code>. - * - * @throws NullPointerException if <code>l</code> is - * <code>null</code>. - * - * @throws EOFException if the input stream ends before all content - * was read. - * - * @throws IOException if some general problem happens with - * accessing data. - * - * @see #readLong() - */ - void readFully(long[] l, int offset, int numLongs) - throws IOException; - - - /** - * Reads a sequence of IEEE 32-bit single-precision floating point - * numbers into a <code>float[]</code> array. If necessary, values - * are converted from the stream’s {@linkplain - * #getByteOrder() current byte order}. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before any data is read. - * - * @param d an array for storing the read values. - * - * @param offset the index of the first element in <code>d</code> - * that will hold read data. - * - * @param numFloats the number of IEEE 32-bit single-precision - * floating point numbers to read (which is one fourth of the number - * of bytes). - * - * @throws IndexOutOfBoundsException if <code>offset</code> or - * <code>numFloats</code> is negative, or if <code>offset + - * numFloats</code> exceeds <code>f.length</code>. - * - * @throws NullPointerException if <code>f</code> is - * <code>null</code>. - * - * @throws EOFException if the input stream ends before all content - * was read. - * - * @throws IOException if some general problem happens with - * accessing data. - * - * @see #readFloat() - */ - void readFully(float[] f, int offset, int numFloats) - throws IOException; - - - /** - * Reads a sequence of IEEE 64-bit double-precision floating point - * numbers into a <code>double[]</code> array. If necessary, values - * are converted from the stream’s {@linkplain - * #getByteOrder() current byte order}. - * - * <p>The {@linkplain #getBitOffset() bit offset} is set to zero - * before any data is read. - * - * @param d an array for storing the read values. - * - * @param offset the index of the first element in <code>d</code> - * that will hold read data. - * - * @param numDoubles the number of IEEE 64-bit double-precision - * floating point numbers to read (which is one eight of the number - * of bytes). - * - * @throws IndexOutOfBoundsException if <code>offset</code> or - * <code>numDoubles</code> is negative, or if <code>offset + - * numDoubles</code> exceeds <code>d.length</code>. - * - * @throws NullPointerException if <code>d</code> is - * <code>null</code>. - * - * @throws EOFException if the input stream ends before all content - * was read. - * - * @throws IOException if some general problem happens with - * accessing data. - * - * @see #readDouble() - */ - void readFully(double[] d, int offset, int numDoubles) - throws IOException; - - long getStreamPosition() - throws IOException; - - int getBitOffset() - throws IOException; - - void setBitOffset(int bitOffset) - throws IOException; - - int readBit() - throws IOException; - - long readBits(int numBits) - throws IOException; - - long length() - throws IOException; - - int skipBytes(int numBytes) - throws IOException; - - long skipBytes(long numBytes) - throws IOException; - - void seek(long pos) - throws IOException; - - void mark(); - - void reset() - throws IOException; - - void flushBefore(long pos) - throws IOException; - - void flush() - throws IOException; - - long getFlushedPosition(); - - boolean isCached(); - - boolean isCachedMemory(); - - boolean isCachedFile(); - - void close() - throws IOException; -} diff --git a/libjava/javax/imageio/stream/ImageInputStreamImpl.java b/libjava/javax/imageio/stream/ImageInputStreamImpl.java deleted file mode 100644 index 0967fee467a..00000000000 --- a/libjava/javax/imageio/stream/ImageInputStreamImpl.java +++ /dev/null @@ -1,515 +0,0 @@ -/* ImageInputStream.java -- - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.stream; - -import java.io.DataInputStream; -import java.io.EOFException; -import java.io.IOException; -import java.nio.ByteOrder; -import java.util.Stack; - -/** - * @author Michael Koch (konqueror@gmx.de) - */ -public abstract class ImageInputStreamImpl implements ImageInputStream -{ - private boolean closed; - private Stack markStack = new Stack(); - - byte[] buffer = new byte[8]; - - protected int bitOffset; - protected ByteOrder byteOrder; - protected long flushedPos; - protected long streamPos; - - public ImageInputStreamImpl() - { - // Do nothing here. - } - - protected final void checkClosed() - throws IOException - { - if (closed) - throw new IOException("stream closed"); - } - - public void close() - throws IOException - { - checkClosed(); - closed = true; - } - - protected void finalize() - throws Throwable - { - close(); - } - - public void flush() - throws IOException - { - flushBefore(getStreamPosition()); - } - - public void flushBefore(long position) - throws IOException - { - if (position < flushedPos) - throw new IndexOutOfBoundsException(); - - if (position > streamPos) - throw new IndexOutOfBoundsException(); - - flushedPos = position; - } - - public int getBitOffset() - throws IOException - { - checkClosed(); - return bitOffset; - } - - public ByteOrder getByteOrder() - { - return byteOrder; - } - - public long getFlushedPosition() - { - return flushedPos; - } - - public long getStreamPosition() - throws IOException - { - checkClosed(); - return streamPos; - } - - public boolean isCached() - { - return false; - } - - public boolean isCachedFile() - { - return false; - } - - public boolean isCachedMemory() - { - return false; - } - - public long length() - { - return -1L; - } - - public void mark() - { - try - { - markStack.push(new Long(getStreamPosition())); - } - catch (IOException e) - { - // Ignored. - } - } - - public abstract int read() - throws IOException; - - public int read(byte[] data) - throws IOException - { - return read(data, 0, data.length); - } - - public abstract int read(byte[] data, int offset, int len) - throws IOException; - - public int readBit() - throws IOException - { - checkClosed(); - - // Calc new bit offset here, readByte resets it. - int newOffset = (bitOffset + 1) & 0x7; - - byte data = readByte(); - - if (bitOffset != 0) - { - seek(getStreamPosition() - 1); - data = (byte) (data >> (8 - newOffset)); - } - - bitOffset = newOffset; - return data & 0x1; - } - - public long readBits(int numBits) - throws IOException - { - checkClosed(); - - if (numBits < 0 || numBits > 64) - throw new IllegalArgumentException(); - - if (numBits == 0) - return 0L; - - long bits = 0L; - - for (int i = 0; i < numBits; i++) - { - bits <<= 1; - bits |= readBit(); - } - - return bits; - } - - public boolean readBoolean() - throws IOException - { - byte data = readByte(); - return data != 0; - } - - public byte readByte() - throws IOException - { - int data = read(); - - if (data == -1) - throw new EOFException(); - - return (byte) data; - } - - public void readBytes(IIOByteBuffer buffer, int len) - throws IOException - { - int result = read(buffer.getData(), buffer.getOffset(), len); - - if (result == -1 || result < len) - throw new EOFException(); - - buffer.setLength(len); - } - - public char readChar() - throws IOException - { - return (char) readShort(); - } - - public double readDouble() - throws IOException - { - return (double) readLong(); - } - - public float readFloat() - throws IOException - { - return (float) readInt(); - } - - public void readFully(byte[] data) - throws IOException - { - readFully(data, 0, data.length); - } - - public void readFully(byte[] data, int offset, int len) - throws IOException - { - for (int i = 0; i < len; ++i) - data[offset + i] = readByte(); - } - - public void readFully(char[] data, int offset, int len) - throws IOException - { - for (int i = 0; i < len; ++i) - data[offset + i] = readChar(); - } - - public void readFully(double[] data, int offset, int len) - throws IOException - { - for (int i = 0; i < len; ++i) - data[offset + i] = readDouble(); - } - - public void readFully(float[] data, int offset, int len) - throws IOException - { - for (int i = 0; i < len; ++i) - data[offset + i] = readFloat(); - } - - public void readFully(int[] data, int offset, int len) - throws IOException - { - for (int i = 0; i < len; ++i) - data[offset + i] = readInt(); - } - - public void readFully(long[] data, int offset, int len) - throws IOException - { - for (int i = 0; i < len; ++i) - data[offset + i] = readLong(); - } - - public void readFully(short[] data, int offset, int len) - throws IOException - { - for (int i = 0; i < len; ++i) - data[offset + i] = readShort(); - } - - public int readInt() - throws IOException - { - int result = read(buffer, 0, 4); - - if (result == -1) - throw new EOFException(); - - if (getByteOrder() == ByteOrder.LITTLE_ENDIAN) - { - return ((buffer[0] & 0xff) - + (buffer[1] << 8) - + (buffer[2] << 16) - + (buffer[3] << 24)); - } - - return ((buffer[4] << 24) - + (buffer[3] << 16) - + (buffer[2] << 8) - + (buffer[1] & 0xff)); - } - - public String readLine() - throws IOException - { - checkClosed(); - - int c = -1; - boolean eol = false; - StringBuffer buffer = new StringBuffer(); - - while (!eol && (c = read()) != -1) - { - switch(c) - { - case '\r': - // Consume following \n' - long oldPosition = getStreamPosition(); - if (read() != '\n') - seek(oldPosition); - case '\n': - eol = true; - break; - default: - buffer.append((char) c); - break; - } - } - - if (c == -1 && buffer.length() == 0) - return null; - - return buffer.toString(); - } - - public long readLong() - throws IOException - { - int result = read(buffer, 0, 8); - - if (result == -1) - throw new EOFException(); - - if (getByteOrder() == ByteOrder.LITTLE_ENDIAN) - { - return ((buffer[0] & 0xff) - + (((buffer[1] & 0xff)) << 8) - + (((buffer[2] & 0xff)) << 16) - + (((buffer[3] & 0xffL)) << 24) - + (((buffer[4] & 0xffL)) << 32) - + (((buffer[5] & 0xffL)) << 40) - + (((buffer[6] & 0xffL)) << 48) - + (((long) buffer[7]) << 56)); - } - - return ((((long) buffer[7]) << 56) - + ((buffer[6] & 0xffL) << 48) - + ((buffer[5] & 0xffL) << 40) - + ((buffer[4] & 0xffL) << 32) - + ((buffer[3] & 0xffL) << 24) - + ((buffer[2] & 0xff) << 16) - + ((buffer[1] & 0xff) << 8) - + (buffer[0] & 0xff)); - } - - public short readShort() - throws IOException - { - int result = read(buffer, 0, 2); - - if (result == -1) - throw new EOFException(); - - if (getByteOrder() == ByteOrder.LITTLE_ENDIAN) - { - return (short) ((buffer[0] & 0xff) - + (buffer[1] << 8)); - } - - return (short) ((buffer[0] << 8) - + (buffer[1] & 0xff)); - } - - public int readUnsignedByte() - throws IOException - { - return readByte() & 0xff; - } - - public long readUnsignedInt() - throws IOException - { - return readInt() & 0xffffffff; - } - - public int readUnsignedShort() - throws IOException - { - return readShort() & 0xffff; - } - - public String readUTF() - throws IOException - { - checkClosed(); - - String data; - ByteOrder old = getByteOrder(); - setByteOrder(ByteOrder.BIG_ENDIAN); // Strings are always big endian. - - try - { - data = DataInputStream.readUTF(this); - } - finally - { - setByteOrder(old); - } - - return data; - } - - public void reset() - throws IOException - { - checkClosed(); - - long mark = ((Long) markStack.pop()).longValue(); - seek(mark); - } - - public void seek(long position) - throws IOException - { - checkClosed(); - - if (position < getFlushedPosition()) - throw new IndexOutOfBoundsException("position < flushed position"); - - streamPos = position; - bitOffset = 0; - } - - public void setBitOffset (int bitOffset) - throws IOException - { - checkClosed(); - - if (bitOffset < 0 || bitOffset > 7) - throw new IllegalArgumentException(); - - this.bitOffset = bitOffset; - } - - public void setByteOrder(ByteOrder byteOrder) - { - this.byteOrder = byteOrder; - } - - public int skipBytes(int num) - throws IOException - { - checkClosed(); - - seek(getStreamPosition() + num); - bitOffset = 0; - return num; - } - - public long skipBytes(long num) - throws IOException - { - checkClosed(); - - seek(getStreamPosition() + num); - bitOffset = 0; - return num; - } -} diff --git a/libjava/javax/imageio/stream/ImageOutputStream.java b/libjava/javax/imageio/stream/ImageOutputStream.java deleted file mode 100644 index 49a1bcf33be..00000000000 --- a/libjava/javax/imageio/stream/ImageOutputStream.java +++ /dev/null @@ -1,269 +0,0 @@ -/* ImageOutputStream.java - Copyright (C) 2004, 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.stream; - -import java.io.DataOutput; -import java.io.IOException; - - -/** - * An output stream for use by {@link javax.imageio.ImageWriter - * ImageWriters}. - * - * @since 1.4 - * - * @author Sascha Brawer (brawer@dandelis.ch) - */ -public interface ImageOutputStream - extends ImageInputStream, DataOutput -{ - /** - * @param postion - * - * @throws IOException if an errror occurs - */ - void flushBefore(long position) throws IOException; - - /** - * Writes an array into the stream. - * - * @param data the data to be written - * - * @throws IOException if an errror occurs - */ - void write(byte[] data) throws IOException; - - /** - * Writes a region of data from an array into the stream. - * - * @param data the data to be written - * @param offset the offset in the array - * @param len the length in the array - * - * @throws IOException if an errror occurs - */ - void write(byte[] data, int offset, int len) throws IOException; - - /** - * Writes an <code>int</code> into the stream. - * - * @param data the data to be written - * - * @throws IOException if an errror occurs - */ - void write(int data) throws IOException; - - /** - * Writes a bit value to the stream. - * - * @throws IOException if an error occurs - */ - void writeBit(int bit) throws IOException; - - /** - * Writes a number of bit values to the stream. - * - * @throws IOException if an errror occurs - */ - void writeBits(long bits, int numBits) throws IOException; - - /** - * Writes a <code>boolean</code> value into the stream. - * - * @param data the data to be written - * - * @throws IOException if an errror occurs - */ - void writeBoolean(boolean data) throws IOException; - - /** - * Writes a <code>byte</code> value into the stream. - * - * @param data the data to be written - * - * @throws IOException if an errror occurs - */ - void writeByte(int data) throws IOException; - - /** - * @param data the data to be written - * - * @throws IOException if an errror occurs - */ - void writeBytes(String data) throws IOException; - - /** - * Writes a character into the stream. - * - * @param data the data to be written - * - * @throws IOException if an errror occurs - */ - void writeChar(int data) throws IOException; - - /** - * Writes characters to the stream. - * - * @param data the data to be written - * @param offset the offset in the array - * @param len the lenth in the array - * - * @throws IOException if an errror occurs - */ - void writeChars(char[] data, int offset, int len) throws IOException; - - /** - * Writes characters from a given <code>String</code> into the stream. - * - * @param data the data to be written - * - * @throws IOException if an errror occurs - */ - void writeChars(String data) throws IOException; - - /** - * Writes a <code>double</code> into the stream. - * - * @param data the data to be written - * - * @throws IOException if an errror occurs - */ - void writeDouble(double data) throws IOException; - - /** - * Writes an array of <code>double</code> into the stream. - * - * @param data the data to be written - * @param offset the offset in the array - * @param len the lenth in the array - * - * @throws IOException if an errror occurs - */ - void writeDoubles(double[] data, int offset, int len) - throws IOException; - - /** - * Writes a <code>float</code> into the stream. - * - * @param data the data to be written - * - * @throws IOException if an errror occurs - */ - void writeFloat(float data) throws IOException; - - /** - * Writes an array of <code>float</code> into the stream. - * - * @param data the data to be written - * @param offset the offset in the array - * @param len the lenth in the array - * - * @throws IOException if an errror occurs - */ - void writeFloats(float[] data, int offset, int len) throws IOException; - - /** - * Writes a <code>int</code> into the stream. - * - * @param data the data to be written - * - * @throws IOException if an errror occurs - */ - void writeInt(int data) throws IOException; - - /** - * Writes an array of <code>int</code> into the stream. - * - * @param data the data to be written - * @param offset the offset in the array - * @param len the lenth in the array - * - * @throws IOException if an errror occurs - */ - void writeInts(int[] data, int offset, int len) throws IOException; - - /** - * Writes a <code>long</code> into the stream. - * - * @param data the data to be written - * - * @throws IOException if an errror occurs - */ - void writeLong(long data) throws IOException; - - /** - * Writes an array of <code>long</code> into the stream. - * - * @param data the data to be written - * @param offset the offset in the array - * @param len the lenth in the array - * - * @throws IOException if an errror occurs - */ - void writeLongs(long[] data, int offset, int len) throws IOException; - - /** - * Writes a <code>short</code> into the stream. - * - * @param data the data to be written - * - * @throws IOException if an errror occurs - */ - void writeShort(int data) throws IOException; - - /** - * Writes an array of <code>short</code> into the stream. - * - * @param data the data to be written - * @param offset the offset in the array - * @param len the lenth in the array - * - * @throws IOException if an errror occurs - */ - void writeShorts(short[] data, int offset, int len) throws IOException; - - /** - * Writes a <code>String</code> into the stream. - * - * @param data the data to be written - * - * @throws IOException if an errror occurs - */ - void writeUTF(String data) throws IOException; -} diff --git a/libjava/javax/imageio/stream/ImageOutputStreamImpl.java b/libjava/javax/imageio/stream/ImageOutputStreamImpl.java deleted file mode 100644 index c708a2368d7..00000000000 --- a/libjava/javax/imageio/stream/ImageOutputStreamImpl.java +++ /dev/null @@ -1,245 +0,0 @@ -/* ImageOutputStream.java -- - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.stream; - -import java.io.IOException; -import java.nio.ByteOrder; - -/** - * @author Michael Koch (konqueror@gmx.de) - */ -public abstract class ImageOutputStreamImpl extends ImageInputStreamImpl - implements ImageOutputStream -{ - public ImageOutputStreamImpl() - { - // Do nothing here. - } - - protected void flushBits() - throws IOException - { - // FIXME: Implement me. - throw new Error("not implemented"); - } - - public void write(byte[] data) - throws IOException - { - write(data, 0, data.length); - } - - public abstract void write(byte[] data, int offset, int len) - throws IOException; - - public abstract void write(int value) - throws IOException; - - public void writeBit(int bit) - throws IOException - { - // FIXME: Implement me. - throw new Error("not implemented"); - } - - public void writeBits(long bits, int numBits) - throws IOException - { - // FIXME: Implement me. - throw new Error("not implemented"); - } - - public void writeBoolean(boolean value) - throws IOException - { - writeByte(value ? 1 : 0); - } - - public void writeByte(int value) - throws IOException - { - write(value & 0xff); - } - - public void writeBytes(String data) - throws IOException - { - write(data.getBytes()); - } - - public void writeChar(int value) - throws IOException - { - writeShort((short) value); - } - - public void writeChars(char[] data, int offset, int len) - throws IOException - { - for(int i = 0; i < len; ++len) - writeChar(data[offset + i]); - } - - public void writeChars(String data) - throws IOException - { - // FIXME: Implement me. - throw new Error("not implemented"); - } - - public void writeDouble(double value) - throws IOException - { - writeLong((long) value); - } - - public void writeDoubles(double[] data, int offset, int len) - throws IOException - { - for(int i = 0; i < len; ++len) - writeDouble(data[offset + i]); - } - - public void writeFloat(float value) - throws IOException - { - writeInt((int) value); - } - - public void writeFloats(float[] data, int offset, int len) - throws IOException - { - for(int i = 0; i < len; ++len) - writeFloat(data[offset + i]); - } - - public void writeInt(int value) - throws IOException - { - if (getByteOrder() == ByteOrder.LITTLE_ENDIAN) - { - buffer[0] = ((byte) value); - buffer[1] = ((byte) (value >> 8)); - buffer[2] = ((byte) (value >> 16)); - buffer[3] = ((byte) (value >> 24)); - } - else - { - buffer[0] = ((byte) (value >> 24)); - buffer[1] = ((byte) (value >> 16)); - buffer[2] = ((byte) (value >> 8)); - buffer[3] = ((byte) value); - } - - write(buffer, 0, 4); - } - - public void writeInts(int[] data, int offset, int len) - throws IOException - { - for(int i = 0; i < len; ++len) - writeInt(data[offset + i]); - } - - public void writeLong(long value) - throws IOException - { - if (getByteOrder() == ByteOrder.LITTLE_ENDIAN) - { - buffer[0] = ((byte) value); - buffer[1] = ((byte) (value >> 8)); - buffer[2] = ((byte) (value >> 16)); - buffer[3] = ((byte) (value >> 24)); - buffer[4] = ((byte) (value >> 32)); - buffer[5] = ((byte) (value >> 40)); - buffer[6] = ((byte) (value >> 48)); - buffer[7] = ((byte) (value >> 56)); - } - else - { - buffer[0] = ((byte) (value >> 56)); - buffer[1] = ((byte) (value >> 48)); - buffer[2] = ((byte) (value >> 40)); - buffer[3] = ((byte) (value >> 32)); - buffer[4] = ((byte) (value >> 24)); - buffer[5] = ((byte) (value >> 16)); - buffer[6] = ((byte) (value >> 8)); - buffer[7] = ((byte) value); - } - - write(buffer, 0, 8); - } - - public void writeLongs(long[] data, int offset, int len) - throws IOException - { - for(int i = 0; i < len; ++len) - writeLong(data[offset + i]); - } - - public void writeShort(int value) - throws IOException - { - if (getByteOrder() == ByteOrder.LITTLE_ENDIAN) - { - buffer[0] = ((byte) value); - buffer[1] = ((byte) (value >> 8)); - } - else - { - buffer[0] = ((byte) (value >> 8)); - buffer[1] = ((byte) value); - } - - write(buffer, 0, 2); - } - - public void writeShorts(short[] data, int offset, int len) - throws IOException - { - for(int i = 0; i < len; ++len) - writeShort(data[offset + i]); - } - - public void writeUTF(String data) - throws IOException - { - throw new Error("not implemented"); - } -} diff --git a/libjava/javax/imageio/stream/MemoryCacheImageInputStream.java b/libjava/javax/imageio/stream/MemoryCacheImageInputStream.java deleted file mode 100644 index 3d9f6184697..00000000000 --- a/libjava/javax/imageio/stream/MemoryCacheImageInputStream.java +++ /dev/null @@ -1,98 +0,0 @@ -/* MemoryCacheImageInputStream.java -- - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.stream; - -import java.io.IOException; -import java.io.InputStream; - -/** - * @author Michael Koch (konqueror@gmx.de) - */ -public class MemoryCacheImageInputStream extends ImageInputStreamImpl -{ - private InputStream stream; - - public MemoryCacheImageInputStream(InputStream stream) - { - this.stream = stream; - } - - public void close() - throws IOException - { - super.close(); - stream.close(); - } - - public void flushBefore(long position) - throws IOException - { - // FIXME: Implement me. - throw new Error("not implemented"); - } - - public boolean isCached() - { - return true; - } - - public boolean isCachedFile() - { - return false; - } - - public boolean isCachedMemory() - { - return true; - } - - public int read() - throws IOException - { - setBitOffset(0); - return stream.read(); - } - - public int read(byte[] data, int offset, int len) - throws IOException - { - setBitOffset(0); - return stream.read(data, offset, len); - } -} diff --git a/libjava/javax/imageio/stream/MemoryCacheImageOutputStream.java b/libjava/javax/imageio/stream/MemoryCacheImageOutputStream.java deleted file mode 100644 index 8914c3305df..00000000000 --- a/libjava/javax/imageio/stream/MemoryCacheImageOutputStream.java +++ /dev/null @@ -1,112 +0,0 @@ -/* MemoryCacheImageOutputStream.java -- - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.imageio.stream; - -import java.io.IOException; -import java.io.OutputStream; - -/** - * @author Michael Koch (konqueror@gmx.de) - */ -public class MemoryCacheImageOutputStream extends ImageOutputStreamImpl -{ - private OutputStream stream; - - public MemoryCacheImageOutputStream(OutputStream stream) - { - this.stream = stream; - } - - public void close() - throws IOException - { - super.close(); - stream.close(); - } - - public void flushBefore(long position) - throws IOException - { - // FIXME: Implement me. - throw new Error("not implemented"); - } - - public boolean isCached() - { - return true; - } - - public boolean isCachedFile() - { - return false; - } - - public boolean isCachedMemory() - { - return true; - } - - public int read() - throws IOException - { - // FIXME: Implement me. - throw new Error("not implemented"); - } - - public int read (byte[] data, int offset, int len) - throws IOException - { - // FIXME: Implement me. - throw new Error("not implemented"); - } - - public void write(byte[] data, int offset, int len) - throws IOException - { - // FIXME: Flush pending bits. - stream.write(data, offset, len); - } - - public void write(int value) - throws IOException - { - // FIXME: Flush pending bits. - stream.write(value); - } -} |