Package javax.imageio.spi

Examples of javax.imageio.spi.ImageReaderSpi


        List<String> possibleExt = Arrays.asList(new String[] { "grb", "grb2", "grib" });
        // Check if the extensions are contained
        Assert.assertTrue(extensions.containsAll(possibleExt));

        // Creation of a NetCDFReaderSPI objectfor checking if it supports the GRIB extension
        ImageReaderSpi spi = new NetCDFImageReaderSpi();
        // Selection of the suffixes, formatNames and mimetypes from the spi object
        List<String> suffixes = Arrays.asList(spi.getFileSuffixes());
        List<String> formatNames = Arrays.asList(spi.getFormatNames());
        List<String> MIMETypes = Arrays.asList(spi.getMIMETypes());
        // Creation of similar lists containing the values for the grib format
        List<String> gribSuffixes = Arrays.asList(new String[] { "grib", "grb", "grb2" });
        List<String> gribFormatNames = Arrays.asList(new String[] { "grib", "grib2", "GRIB",
                "GRIB2" });
        List<String> gribMIMETypes = Arrays.asList(new String[] { "application/octet-stream" });
View Full Code Here


                            LOGGER.log(Level.WARNING,Utils.getFileInfo(fileBeingProcessed));
                        }
                        throw new IllegalArgumentException("Unable to get an input stream for the provided file "+granuleUrl.toString());
                    }
                    // Selection of the ImageReaderSpi from the Stream
                    ImageReaderSpi spi = Utils.getReaderSpiFromStream(null, inStream);
                    // Setting of the ImageReaderSpi to the ImageMosaicConfigHandler in order to set it inside the indexer properties
                    configHandler.setCachedReaderSPI(spi);
                }finally{
                    if(inStream!=null){
                        inStream.close();
View Full Code Here

        } else
            throw new IllegalArgumentException("Unsupported Input type:" + input);

        PlanarImage planarImage;
        ImageReader reader;
        ImageReaderSpi readerSpi = spi;
        if (useJAI) {
            final ParameterBlock pbjImageRead = new ParameterBlock();
            pbjImageRead.add(paramInput);
            pbjImageRead.add(imageIndex);
            pbjImageRead.add(Boolean.FALSE);
            pbjImageRead.add(Boolean.FALSE);
            pbjImageRead.add(Boolean.FALSE);
            pbjImageRead.add(null);
            pbjImageRead.add(null);
            pbjImageRead.add(imageReadParam);
            reader = readerSpi.createReaderInstance();
            pbjImageRead.add(reader);

            // Check if to use a simple JAI ImageRead operation or a
            // multithreaded one
            final String jaiOperation = useMultithreading ? "ImageReadMT" : "ImageRead";
            // final String jaiOperation = "ImageRead";
            /** TODO: SET HINTS */
            planarImage = JAI.create(jaiOperation, pbjImageRead, null);
        } else {
            reader = readerSpi.createReaderInstance();
            reader.setInput(paramInput, true, true);
            planarImage = PlanarImage.wrapRenderedImage(reader.read(imageIndex, imageReadParam));
            reader.dispose();
        }
        return planarImage;
View Full Code Here

                    reader = Utils.getReader(stream);
                    if (reader != null) {
                        reader.setInput(stream);
                       
                        // Setting up properties
                        final ImageReaderSpi spi = reader.getOriginatingProvider();
                        final int width = reader.getWidth(0);
                        final int height = reader.getHeight(0);
                        int numOverviews = reader.getNumImages(false) - 1;
                        if (numOverviews < 0) {
                            numOverviews = 0;
View Full Code Here

        File file = TestData.file(this, "sampleGrib.grb2");
        // Check if the grib file is accepted by the NetCDF driver
        AbstractGridFormat format = new GRIBFormat();
        Assert.assertTrue(format.accepts(file));
        // Check if the netcdf reader spi object can read the input file
        ImageReaderSpi spi = new NetCDFImageReaderSpi();
        Assert.assertTrue(spi.canDecodeInput(file));
    }
View Full Code Here

            Iterator readerSPIs =
                registry.getServiceProviders(imageReaderClass,
                                             new JPEGSPIFilter(),
                                             true);
            if(readerSPIs.hasNext()) {
                ImageReaderSpi jpegReaderSPI =
                    (ImageReaderSpi)readerSPIs.next();
                jpegReader = jpegReaderSPI.createReaderInstance();
            }
        } catch(Exception e) {
            // Ignore it ...
        }
View Full Code Here

     */
    private static class JPEGSPIFilter implements ServiceRegistry.Filter {
        JPEGSPIFilter() {}

        public boolean filter(Object provider) {
            ImageReaderSpi readerSPI = (ImageReaderSpi)provider;

            if(readerSPI != null) {
                String streamMetadataName =
                    readerSPI.getNativeStreamMetadataFormatName();
                if(streamMetadataName != null) {
                    return streamMetadataName.equals(STREAM_METADATA_NAME);
                } else {
                    return false;
                }
View Full Code Here

        IIORegistry theRegistry = initializer.getRegistry();
        // Checks for each Spi class if it is present and then it is added to the list.
        for (String spi : readerSpi) {
            try {
                Class<?> clazz = Class.forName(spi);
                ImageReaderSpi reader = (ImageReaderSpi) theRegistry
                        .getServiceProviderByClass(clazz);
                if (reader != null) {
                    this.spi=reader;
                    break;
                }
View Full Code Here

        if (!isAggressiveInputStreamSupported() && aggressiveInputStreamOptimization) {
            throw new UnsupportedOperationException(OPERATION_NOT_SUPPORTED);
        }

        // Selection of the first priority writerSpi
        ImageReaderSpi newSpi = getReaderSpi();
       
        if(newSpi!=null){
            // Creation of the associated Writer
            ImageReader reader = null;
            ImageInputStream stream = null;
            try {
                reader = newSpi.createReaderInstance();
                if (source instanceof FileResource) {
                    // file
                    stream= new FileImageInputStreamExtImpl(((FileResource)source).getFile());
                    // Image reading
                    reader.setInput(stream);
View Full Code Here

TOP

Related Classes of javax.imageio.spi.ImageReaderSpi

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.