[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cp-patches] FYI: complete javax.imageio.spi.ImageReaderWriterSpi
From: |
Thomas Fitzsimmons |
Subject: |
[cp-patches] FYI: complete javax.imageio.spi.ImageReaderWriterSpi |
Date: |
Mon, 24 Oct 2005 16:45:28 -0400 |
Hi,
I added the two missing methods to ImageReaderWriterSpi. Now
javax.imageio.spi is 1.5-complete.
Tom
2005-10-24 Thomas Fitzsimmons <address@hidden>
* javax/imageio/spi/ImageReaderWriterSpi.java
(getStreamMetadataFormat): Implement.
(getImageMetadataFormat): Likewise.
Index: javax/imageio/spi/ImageReaderWriterSpi.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/javax/imageio/spi/ImageReaderWriterSpi.java,v
retrieving revision 1.5
diff -u -r1.5 ImageReaderWriterSpi.java
--- javax/imageio/spi/ImageReaderWriterSpi.java 2 Jul 2005 20:32:45 -0000
1.5
+++ javax/imageio/spi/ImageReaderWriterSpi.java 24 Oct 2005 20:43:10 -0000
@@ -38,6 +38,8 @@
package javax.imageio.spi;
+import javax.imageio.metadata.IIOMetadataFormat;
+import javax.imageio.metadata.IIOMetadataFormatImpl;
/**
* An abstract superclass that contains the common parts of address@hidden
@@ -421,5 +423,89 @@
public String[] getExtraImageMetadataFormatNames()
{
return extraImageMetadataFormatNames;
+ }
+
+ /**
+ * Returns an IIOMetadataFormat object that represents the requested
+ * stream metadata format or null if the given format is supported
+ * but no IIOMetadataFormat can be created for it.
+ *
+ * @param formatName the requested stream metadata format name
+ *
+ * @return an IIOMetadataFormat object or null
+ *
+ * @throws IllegalArgumentException if formatName is null or is not
+ * one of the standard metadata format or this provider's native or
+ * extra stream metadata formats
+ */
+ public IIOMetadataFormat getStreamMetadataFormat (String formatName)
+ {
+ if (formatName == null)
+ throw new IllegalArgumentException ("null stream metadata format name");
+
+ if (!formatName.equals (getNativeStreamMetadataFormatName())
+ && !formatName.equals
(IIOMetadataFormatImpl.standardMetadataFormatName))
+ {
+ String[] extraNames = getExtraStreamMetadataFormatNames ();
+ boolean foundName = false;
+ for (int i = 0; i < extraNames.length; i++)
+ {
+ if (formatName.equals(extraNames[i]))
+ {
+ foundName = true;
+ break;
+ }
+ }
+ if (!foundName)
+ throw new IllegalArgumentException ("unsupported stream metadata
format name");
+ }
+
+ if (formatName.equals (IIOMetadataFormatImpl.standardMetadataFormatName))
+ return IIOMetadataFormatImpl.getStandardFormatInstance ();
+ else
+ // Default implementation returns null.
+ return null;
+ }
+
+ /**
+ * Returns an IIOMetadataFormat object that represents the requested
+ * image metadata format or null if the given format is supported
+ * but no IIOMetadataFormat can be created for it.
+ *
+ * @param formatName the requested image metadata format name
+ *
+ * @return an IIOMetadataFormat object or null
+ *
+ * @throws IllegalArgumentException if formatName is null or is not
+ * one of the standard metadata format or this provider's native or
+ * extra image metadata formats
+ */
+ public IIOMetadataFormat getImageMetadataFormat (String formatName)
+ {
+ if (formatName == null)
+ throw new IllegalArgumentException ("null image metadata format name");
+
+ if (!formatName.equals (getNativeImageMetadataFormatName())
+ && !formatName.equals
(IIOMetadataFormatImpl.standardMetadataFormatName))
+ {
+ String[] extraNames = getExtraImageMetadataFormatNames ();
+ boolean foundName = false;
+ for (int i = 0; i < extraNames.length; i++)
+ {
+ if (formatName.equals(extraNames[i]))
+ {
+ foundName = true;
+ break;
+ }
+ }
+ if (!foundName)
+ throw new IllegalArgumentException ("unsupported image metadata
format name");
+ }
+
+ if (formatName.equals (IIOMetadataFormatImpl.standardMetadataFormatName))
+ return IIOMetadataFormatImpl.getStandardFormatInstance ();
+ else
+ // Default implementation returns null.
+ return null;
}
}
- [cp-patches] FYI: complete javax.imageio.spi.ImageReaderWriterSpi,
Thomas Fitzsimmons <=