List of usage examples for javax.imageio ImageReader getClass
@HotSpotIntrinsicCandidate public final native Class<?> getClass();
From source file:nl.b3p.imagetool.ImageTool.java
/** * Private method which seeks through the supported image readers to check * if a there is a reader which handles the specified MIME. This method * checks spe- cifically for JPG or PNG images because Sun's Java supports * two kind of readers for these particular formats. And because one of * these readers doesn't function well, we need to be sure we have the right * reader./*from w ww. j a v a2 s. c o m*/ * * @param mime String with the MIME to find. * * @return ImageReader which can handle the specified MIME or null if no * reader was found. */ // <editor-fold defaultstate="" desc="getJPGOrPNGReader(String mime) method."> private static ImageReader getJPGOrPNGReader(String mime) { Iterator it = ImageIO.getImageReadersByMIMEType(mime); ImageReader imTest = null; String name = null; while (it.hasNext()) { imTest = (ImageReader) it.next(); name = imTest.getClass().getPackage().getName(); String generalPackage = name.substring(0, name.lastIndexOf(".")); if (generalPackage.equalsIgnoreCase("com.sun.media.imageioimpl.plugins")) { continue; } } //log.info("Using ImageReader: " + name); return imTest; }
From source file:nl.b3p.imagetool.ImageTool.java
/** * Private method which seeks through the supported image readers to check * if a there is a reader which handles the specified MIME. This method * checks spe- cifically for GIF or TIFF images. * * @param mime String with the MIME to find. * * @return ImageReader which can handle the specified MIME or null if no * reader was found.//from ww w.j a v a 2s . com */ // <editor-fold defaultstate="" desc="getGIFOrTIFFReader(String mime) method."> private static ImageReader getGIFOrTIFFReader(String mime) { Iterator it = ImageIO.getImageReadersByMIMEType(mime); ImageReader imTest = null; String name = null; while (it.hasNext()) { imTest = (ImageReader) it.next(); name = imTest.getClass().getPackage().getName(); } //log.info("Using ImageReader: " + name); return imTest; }
From source file:org.dcm4che2.tool.dcm2dcm.Dcm2Dcm.java
/** * Check if a reader is reading compressed data *//* w w w . j a va 2 s .c om*/ private boolean isCompressed(ImageReader reader) throws NoSuchFieldException, IllegalAccessException { Class<?> clazz = reader.getClass(); java.lang.reflect.Field compressed = clazz.getDeclaredField("compressed"); compressed.setAccessible(true); return compressed.getBoolean(reader); }
From source file:org.geotools.gce.imagemosaic.GranuleDescriptor.java
private boolean customizeReaderInitialization(ImageReader reader, Hints hints) { String classString = reader.getClass().getName(); // Special Management for NetCDF readers to set external Auxiliary File if (hints != null && hints.containsKey(Utils.AUXILIARY_FILES_PATH)) { if (classString.equalsIgnoreCase("org.geotools.imageio.netcdf.NetCDFImageReader")) { try { String auxiliaryFilePath = (String) hints.get(Utils.AUXILIARY_FILES_PATH); MethodUtils.invokeMethod(reader, "setAuxiliaryFilesPath", auxiliaryFilePath); return true; } catch (NoSuchMethodException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } catch (InvocationTargetException e) { throw new RuntimeException(e); }//from w w w. j ava 2 s . co m } } return false; }