summaryrefslogtreecommitdiff
path: root/javax/imageio
diff options
context:
space:
mode:
authorSascha Brawer <brawer@dandelis.ch>2004-04-13 13:54:10 +0000
committerSascha Brawer <brawer@dandelis.ch>2004-04-13 13:54:10 +0000
commit0fd03c62a55b1056209b9be939b1fac7dbdcba8b (patch)
tree054da97a1c08951289dff5dc762e9c09f2a3e92a /javax/imageio
parentf64d71da8330e556fa9a8d1e8279d4b9d451342b (diff)
downloadclasspath-0fd03c62a55b1056209b9be939b1fac7dbdcba8b.tar.gz
Implemented some classes in javax.imageio.spi.
Diffstat (limited to 'javax/imageio')
-rw-r--r--javax/imageio/ImageReader.java46
-rw-r--r--javax/imageio/ImageTranscoder.java46
-rw-r--r--javax/imageio/ImageWriter.java47
-rw-r--r--javax/imageio/spi/IIOServiceProvider.java163
-rw-r--r--javax/imageio/spi/ImageInputStreamSpi.java144
-rw-r--r--javax/imageio/spi/ImageOutputStreamSpi.java143
-rw-r--r--javax/imageio/spi/ImageReaderWriterSpi.java425
-rw-r--r--javax/imageio/spi/ImageTranscoderSpi.java84
-rw-r--r--javax/imageio/stream/IIOByteBuffer.java94
-rw-r--r--javax/imageio/stream/ImageInputStream.java652
-rw-r--r--javax/imageio/stream/ImageOutputStream.java58
11 files changed, 1902 insertions, 0 deletions
diff --git a/javax/imageio/ImageReader.java b/javax/imageio/ImageReader.java
new file mode 100644
index 000000000..75ae9ad60
--- /dev/null
+++ b/javax/imageio/ImageReader.java
@@ -0,0 +1,46 @@
+/* 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., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 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;
+
+public abstract class ImageReader
+{
+ // FIXME: Incomplete. This class is merely present in order to allow
+ // compilation of the javax.imageio.spi package, for which GNU
+ // Classpath does provide an implementation.
+}
diff --git a/javax/imageio/ImageTranscoder.java b/javax/imageio/ImageTranscoder.java
new file mode 100644
index 000000000..20c695998
--- /dev/null
+++ b/javax/imageio/ImageTranscoder.java
@@ -0,0 +1,46 @@
+/* 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., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 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;
+
+public interface ImageTranscoder
+{
+ // FIXME: Incomplete. This interface is merely present in order to
+ // allow compilation of the javax.imageio.spi package, for which GNU
+ // Classpath does provide an implementation.
+}
diff --git a/javax/imageio/ImageWriter.java b/javax/imageio/ImageWriter.java
new file mode 100644
index 000000000..7ef60c365
--- /dev/null
+++ b/javax/imageio/ImageWriter.java
@@ -0,0 +1,47 @@
+/* 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., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 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;
+
+public abstract class ImageWriter
+ implements ImageTranscoder
+{
+ // FIXME: Incomplete. This class is merely present in order to allow
+ // compilation of the javax.imageio.spi package, for which GNU
+ // Classpath does provide an implementation.
+}
diff --git a/javax/imageio/spi/IIOServiceProvider.java b/javax/imageio/spi/IIOServiceProvider.java
new file mode 100644
index 000000000..bd0a44933
--- /dev/null
+++ b/javax/imageio/spi/IIOServiceProvider.java
@@ -0,0 +1,163 @@
+/* IIOServiceProvider.java -- General service provider for image I/O.
+ 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., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 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 <a href="mailto:brawer@dandelis.ch">Sascha Brawer</a>
+ */
+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/javax/imageio/spi/ImageInputStreamSpi.java b/javax/imageio/spi/ImageInputStreamSpi.java
new file mode 100644
index 000000000..b8d58547d
--- /dev/null
+++ b/javax/imageio/spi/ImageInputStreamSpi.java
@@ -0,0 +1,144 @@
+/* ImageInputStreamSpi.java -- Service provider for image input streams.
+ 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., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 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 <a href="mailto:brawer@dandelis.ch">Sascha Brawer</a>
+ */
+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/javax/imageio/spi/ImageOutputStreamSpi.java b/javax/imageio/spi/ImageOutputStreamSpi.java
new file mode 100644
index 000000000..aa287c313
--- /dev/null
+++ b/javax/imageio/spi/ImageOutputStreamSpi.java
@@ -0,0 +1,143 @@
+/* ImageOutputStreamSpi.java -- Service provider for image output streams.
+ 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., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 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 <a href="mailto:brawer@dandelis.ch">Sascha Brawer</a>
+ */
+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/javax/imageio/spi/ImageReaderWriterSpi.java b/javax/imageio/spi/ImageReaderWriterSpi.java
new file mode 100644
index 000000000..e686ebba0
--- /dev/null
+++ b/javax/imageio/spi/ImageReaderWriterSpi.java
@@ -0,0 +1,425 @@
+/* ImageReaderWriterSpi.java -- Superclass for image reader and writer spis.
+ 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., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 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 <a href="mailto:brawer@dandelis.ch">Sascha Brawer</a>
+ */
+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>&#x201c;javax_imageio_1.0&#x201d;</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>&#x201c;javax_imageio_1.0&#x201d;</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.
+ */
+ protected 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>[&#x201c;Tagged Image File
+ * Format&#x201d;, &#x201c;Portable Network
+ * Graphics&#x201d;]</code>.
+ *
+ * @param suffixes the file suffixes of the supported image formats,
+ * for example <code>[&#x201c;tiff&#x201d;, &#x201c;tif&#x201d;,
+ * &#x201c;png&#x201d;]</code>.
+ *
+ * @param MIMETypes the MIME types of the supported image formats,
+ * for example <code>[&#x201c;image/tiff&#x201d;,
+ * &#x201c;image/png&#x201d;]</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>&#x201c;javax_imageio_1.0&#x201d;</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>&#x201c;javax_imageio_1.0&#x201d;</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>[&#x201c;Tagged Image File Format&#x201d;,
+ * &#x201c;Portable Network Graphics&#x201d;]</code>.
+ */
+ public String[] getFormatNames()
+ {
+ return names;
+ }
+
+
+ /**
+ * Returns the file suffixes of the supported image formats, for
+ * example <code>[&#x201c;tiff&#x201d;, &#x201c;tif&#x201d;,
+ * &#x201c;png&#x201d;]</code>.
+ */
+ public String[] getFileSuffixes()
+ {
+ return suffixes;
+ }
+
+
+ /**
+ * Returns the MIME types of the supported image formats, for
+ * example <code>[&#x201c;image/tiff&#x201d;,
+ * &#x201c;image/png&#x201d;]</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>&#x201c;javax_imageio_1.0&#x201d;</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>&#x201c;javax_imageio_1.0&#x201d;</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/javax/imageio/spi/ImageTranscoderSpi.java b/javax/imageio/spi/ImageTranscoderSpi.java
new file mode 100644
index 000000000..85ca77d46
--- /dev/null
+++ b/javax/imageio/spi/ImageTranscoderSpi.java
@@ -0,0 +1,84 @@
+/* ImageTranscoderSpi.java -- Factory for image metadata transcoders.
+ 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., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 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 <a href="mailto:brawer@dandelis.ch">Sascha Brawer</a>
+ */
+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/javax/imageio/stream/IIOByteBuffer.java b/javax/imageio/stream/IIOByteBuffer.java
new file mode 100644
index 000000000..c9e230f5f
--- /dev/null
+++ b/javax/imageio/stream/IIOByteBuffer.java
@@ -0,0 +1,94 @@
+/* IIOByteBuffer.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., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 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 <a href="mailto:brawer@dandelis.ch">Sascha Brawer</a>
+ */
+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/javax/imageio/stream/ImageInputStream.java b/javax/imageio/stream/ImageInputStream.java
new file mode 100644
index 000000000..4b509f857
--- /dev/null
+++ b/javax/imageio/stream/ImageInputStream.java
@@ -0,0 +1,652 @@
+/* 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., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 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.EOFException;
+import java.io.IOException;
+import java.nio.ByteOrder;
+
+
+/**
+ * An input stream for use by {@link javax.imageio.ImageReader
+ * ImageReaders}.
+ *
+ * @since 1.4
+ *
+ * @author <a href="mailto:brawer@dandelis.ch">Sascha Brawer</a>
+ */
+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&#x2019;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&#x2019;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&#x2019;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&#x2019;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&#x2019;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&#x2019;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&#x2019;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&#x2019;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&#x2019;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&#x2019;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&#x2019;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&#x2019;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&#x2019;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&#x2019;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()
+ throws IOException;
+
+ 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/javax/imageio/stream/ImageOutputStream.java b/javax/imageio/stream/ImageOutputStream.java
new file mode 100644
index 000000000..58a65944a
--- /dev/null
+++ b/javax/imageio/stream/ImageOutputStream.java
@@ -0,0 +1,58 @@
+/* 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., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 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;
+
+
+/**
+ * An output stream for use by {@link javax.imageio.ImageWriter
+ * ImageWriters}.
+ *
+ * @since 1.4
+ *
+ * @author <a href="mailto:brawer@dandelis.ch">Sascha Brawer</a>
+ */
+public interface ImageOutputStream
+ extends ImageInputStream, DataOutput
+{
+ // FIXME: Incomplete. This interface is merely present in order to
+ // allow compilation of the javax.imageio.spi package, for which GNU
+ // Classpath does provide an implementation.
+}