harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yangl...@apache.org
Subject svn commit: r1006337 - in /harmony/enhanced/java/branches/java6/classlib/modules/imageio/src: main/java/javax/imageio/ImageIO.java test/java/javax/imageio/ImageIOTest.java
Date Sun, 10 Oct 2010 18:59:50 GMT
Author: yanglang
Date: Sun Oct 10 18:59:50 2010
New Revision: 1006337

URL: http://svn.apache.org/viewvc?rev=1006337&view=rev
Log:
Apply patch for HARMONY-6626 (Implement two java6 only methods)
ImageIO.getWriterFileSuffixes()
ImageIO.getReaderFileSuffixes()

Modified:
    harmony/enhanced/java/branches/java6/classlib/modules/imageio/src/main/java/javax/imageio/ImageIO.java
    harmony/enhanced/java/branches/java6/classlib/modules/imageio/src/test/java/javax/imageio/ImageIOTest.java

Modified: harmony/enhanced/java/branches/java6/classlib/modules/imageio/src/main/java/javax/imageio/ImageIO.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/imageio/src/main/java/javax/imageio/ImageIO.java?rev=1006337&r1=1006336&r2=1006337&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/imageio/src/main/java/javax/imageio/ImageIO.java
(original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/imageio/src/main/java/javax/imageio/ImageIO.java
Sun Oct 10 18:59:50 2010
@@ -126,6 +126,18 @@ public final class ImageIO {
 
         return (String[])MIMETypes.toArray(new String[MIMETypes.size()]);
     }
+    
+    public static String[] getReaderFileSuffixes() {
+        List<String> suffixes = new ArrayList<String>();
+        
+        Iterator<ImageReaderSpi> it = registry.getServiceProviders(ImageReaderSpi.class,
true);
+        while (it.hasNext()) {
+            ImageReaderSpi spi = it.next();
+            suffixes.addAll(Arrays.asList(spi.getFileSuffixes()));
+        }
+        
+        return (String[])suffixes.toArray(new String[suffixes.size()]);
+    }
 
     public static Iterator<ImageReader> getImageReaders(Object input) {
         if (input == null) {
@@ -189,6 +201,18 @@ public final class ImageIO {
 
         return (String[])MIMETypes.toArray(new String[MIMETypes.size()]);
     }
+    
+    public static String[] getWriterFileSuffixes() {
+        List<String> suffixes = new ArrayList<String>();
+        
+        Iterator<ImageWriterSpi> it = registry.getServiceProviders(ImageWriterSpi.class,
true);
+        while (it.hasNext()) {
+            ImageWriterSpi spi = it.next();
+            suffixes.addAll(Arrays.asList(spi.getFileSuffixes()));
+        }
+        
+        return (String[])suffixes.toArray(new String[suffixes.size()]);
+    }
 
     public static Iterator<ImageWriter> getImageWritersByFormatName(String formatName)
{
         if (formatName == null) {

Modified: harmony/enhanced/java/branches/java6/classlib/modules/imageio/src/test/java/javax/imageio/ImageIOTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/imageio/src/test/java/javax/imageio/ImageIOTest.java?rev=1006337&r1=1006336&r2=1006337&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/imageio/src/test/java/javax/imageio/ImageIOTest.java
(original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/imageio/src/test/java/javax/imageio/ImageIOTest.java
Sun Oct 10 18:59:50 2010
@@ -145,4 +145,19 @@ public class ImageIOTest extends TestCas
         assertTrue(actualFormatNames.containsAll(expectedFormatNames));
     }
 
+    public void testGetReaderFileSuffixes() {
+        Set<String> expectedSuffixes = new HashSet<String>(Arrays.asList(new
String[] {
+            "jpeg", "jpg", "gif", "png" }));
+        
+        Set<String> actualSuffixes = new HashSet<String>(Arrays.asList(ImageIO.getReaderFileSuffixes()));
+        assertTrue(actualSuffixes.containsAll(expectedSuffixes));
+    }
+    
+    public void testGetWriterFileSuffixes() {
+        Set<String> expectedSuffixes = new HashSet<String>(Arrays.asList(new
String[] {
+            "jpeg", "jpg", "png" }));
+        
+        Set<String> actualSuffixes = new HashSet<String>(Arrays.asList(ImageIO.getWriterFileSuffixes()));
+        assertTrue(actualSuffixes.containsAll(expectedSuffixes));
+    }
 }



Mime
View raw message