Package com.lightcrafts.media.jai.util

Examples of com.lightcrafts.media.jai.util.DisposableNullOpImage


            }

            OpImage image = null;
            try {
                // Attempt to create an OpImage from the decoder image.
                image = new DisposableNullOpImage(dec.decodeAsRenderedImage(page),
                                                  layout,
                                                  renderHints,
                                                  bound);
            } catch(OutOfMemoryError memoryError) {
                // Ran out of memory - may be due to the decoder being
                // obliged to read the entire image when it creates the
                // RenderedImage it returns.
                if(canAttemptRecovery) {
                    // First flush the cache if one is defined.
                    TileCache cache = image != null ?
                        image.getTileCache() :
                        RIFUtil.getTileCacheHint(renderHints);
                    if(cache != null) {
                        cache.flush();
                    }

                    // Force garbage collection.
                    System.gc(); //slow

                    // Reposition the stream before the previous decoding.
                    source.seek(streamPosition);

                    // Retry image decoding.
                    image = new DisposableNullOpImage(dec.decodeAsRenderedImage(page),
                                                      layout,
                                                      renderHints,
                                                      bound);
                } else {
                    // Re-throw the error.
View Full Code Here


                im = null;
            }

            // If decoding succeeded, wrap the result in an OpImage.
            if (im != null) {
                return new DisposableNullOpImage(im, layout,
                                                 renderHints, bound);
            }
        }

        return null;
View Full Code Here

TOP

Related Classes of com.lightcrafts.media.jai.util.DisposableNullOpImage

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.