< prev index next >

src/demo/share/java2d/J2DBench/src/j2dbench/tests/iio/InputImageTests.java

Print this page


   1 /*
   2  * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
   3  *
   4  * Redistribution and use in source and binary forms, with or without
   5  * modification, are permitted provided that the following conditions
   6  * are met:
   7  *
   8  *   - Redistributions of source code must retain the above copyright
   9  *     notice, this list of conditions and the following disclaimer.
  10  *
  11  *   - Redistributions in binary form must reproduce the above copyright
  12  *     notice, this list of conditions and the following disclaimer in the
  13  *     documentation and/or other materials provided with the distribution.
  14  *
  15  *   - Neither the name of Oracle nor the names of its
  16  *     contributors may be used to endorse or promote products derived
  17  *     from this software without specific prior written permission.
  18  *
  19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
  20  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  21  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR


 167             new ImageReaderGetImageMetadata();
 168         }
 169     }
 170 
 171     private static void initIIOReadFormats() {
 172         List spis = new ArrayList();
 173         List shortNames = new ArrayList();
 174 
 175         ImageIO.scanForPlugins();
 176         IIORegistry registry = IIORegistry.getDefaultInstance();
 177         java.util.Iterator readerspis =
 178             registry.getServiceProviders(ImageReaderSpi.class, false);
 179         while (readerspis.hasNext()) {
 180             // REMIND: there could be more than one non-core plugin for
 181             // a particular format, as is the case for JPEG2000 in the JAI
 182             // IIO Tools package, so we should support that somehow
 183             ImageReaderSpi spi = (ImageReaderSpi)readerspis.next();
 184             String klass = spi.getClass().getName();
 185             String format = spi.getFormatNames()[0].toLowerCase();
 186             String suffix = spi.getFileSuffixes()[0].toLowerCase();
 187             if (suffix == null || suffix.equals("")) {
 188                 suffix = format;
 189             }
 190             String shortName;
 191             if (klass.startsWith("com.sun.imageio.plugins")) {
 192                 shortName = "core-" + suffix;
 193             } else {
 194                 shortName = "ext-" + suffix;
 195             }
 196             spis.add(spi);
 197             shortNames.add(shortName);
 198         }
 199 
 200         imageioReaderSpis = new ImageReaderSpi[spis.size()];
 201         imageioReaderSpis = (ImageReaderSpi[])spis.toArray(imageioReaderSpis);
 202         imageioReadFormatShortNames = new String[shortNames.size()];
 203         imageioReadFormatShortNames =
 204             (String[])shortNames.toArray(imageioReadFormatShortNames);
 205     }
 206 
 207     protected InputImageTests(Group parent,


   1 /*
   2  * Copyright (c) 2006, 2019, Oracle and/or its affiliates. All rights reserved.
   3  *
   4  * Redistribution and use in source and binary forms, with or without
   5  * modification, are permitted provided that the following conditions
   6  * are met:
   7  *
   8  *   - Redistributions of source code must retain the above copyright
   9  *     notice, this list of conditions and the following disclaimer.
  10  *
  11  *   - Redistributions in binary form must reproduce the above copyright
  12  *     notice, this list of conditions and the following disclaimer in the
  13  *     documentation and/or other materials provided with the distribution.
  14  *
  15  *   - Neither the name of Oracle nor the names of its
  16  *     contributors may be used to endorse or promote products derived
  17  *     from this software without specific prior written permission.
  18  *
  19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
  20  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  21  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR


 167             new ImageReaderGetImageMetadata();
 168         }
 169     }
 170 
 171     private static void initIIOReadFormats() {
 172         List spis = new ArrayList();
 173         List shortNames = new ArrayList();
 174 
 175         ImageIO.scanForPlugins();
 176         IIORegistry registry = IIORegistry.getDefaultInstance();
 177         java.util.Iterator readerspis =
 178             registry.getServiceProviders(ImageReaderSpi.class, false);
 179         while (readerspis.hasNext()) {
 180             // REMIND: there could be more than one non-core plugin for
 181             // a particular format, as is the case for JPEG2000 in the JAI
 182             // IIO Tools package, so we should support that somehow
 183             ImageReaderSpi spi = (ImageReaderSpi)readerspis.next();
 184             String klass = spi.getClass().getName();
 185             String format = spi.getFormatNames()[0].toLowerCase();
 186             String suffix = spi.getFileSuffixes()[0].toLowerCase();
 187             if (suffix == null || suffix.isEmpty()) {
 188                 suffix = format;
 189             }
 190             String shortName;
 191             if (klass.startsWith("com.sun.imageio.plugins")) {
 192                 shortName = "core-" + suffix;
 193             } else {
 194                 shortName = "ext-" + suffix;
 195             }
 196             spis.add(spi);
 197             shortNames.add(shortName);
 198         }
 199 
 200         imageioReaderSpis = new ImageReaderSpi[spis.size()];
 201         imageioReaderSpis = (ImageReaderSpi[])spis.toArray(imageioReaderSpis);
 202         imageioReadFormatShortNames = new String[shortNames.size()];
 203         imageioReadFormatShortNames =
 204             (String[])shortNames.toArray(imageioReadFormatShortNames);
 205     }
 206 
 207     protected InputImageTests(Group parent,


< prev index next >