Package javax.imageio

Examples of javax.imageio.ImageReader.dispose()


        // avoid to access the meta information
        ImageReader reader = (ImageReader) readers.next();
        reader.setInput(input);
        Raster raster = reader.readRaster(0, reader.getDefaultReadParam());
        input.close();
        reader.dispose();
        return raster;
    }

    // CMYK jpegs are not supported by JAI, so that we have to do the conversion on our own
    private BufferedImage convertCMYK2RGB(Raster raster, PDColorSpace colorspace) throws IOException
View Full Code Here


            "Could not find javax.imageio.ImageReader for Content-Type [" + contentType + "]");
      }
    }
    finally {
      if (imageReader != null) {
        imageReader.dispose();
      }
      if (imageInputStream != null) {
        try {
          imageInputStream.close();
        }
View Full Code Here

        Raster raster = reader.readRaster(0, reader.getDefaultReadParam());
        if (input != null)
        {
            input.close();
        }
        reader.dispose();
        return raster;
    }

    // CMYK jpegs are not supported by JAI, so that we have to do the conversion on our own
    private BufferedImage convertCMYK2RGB(Raster raster, PDColorSpace colorspace) throws IOException
View Full Code Here

            ImageInputStream in = ImageIO.createImageInputStream(entityStream);
            reader.setInput(in, true, true);
            BufferedImage bi = reader.read(0, reader.getDefaultReadParam());
            in.close();
            reader.dispose();
            return bi;
        } else {
            return ImageIO.read(entityStream);
        }
    }
View Full Code Here

            ImageInputStream in = ImageIO.createImageInputStream(entityStream);
            reader.setInput(in, true, true);
            BufferedImage bi = reader.read(0, reader.getDefaultReadParam());
            in.close();
            reader.dispose();
            return bi;
        } else {
            return ImageIO.read(entityStream);
        }
    }
View Full Code Here

                    } catch (IIOException iioe) {
                        //ignore
                    }
                    imgStream.reset();
                } finally {
                    reader.dispose();
                }
            }
        } finally {
            //ImageUtil.closeQuietly(src); //Cannot do that as codecs my do late reading
            ImageUtil.removeStreams(src);
View Full Code Here

                mime = reader.getOriginatingProvider().getMIMETypes()[0];
                break;
            } catch (IOException ioe) {
                //ignore and continue
            } finally {
                reader.dispose();
                in.reset();
            }
        }
       
        //Resolution (first a default, then try to read the metadata)
View Full Code Here

                    } catch (IIOException iioe) {
                        //ignore
                    }
                    imgStream.reset();
                } finally {
                    reader.dispose();
                }
            }
        } finally {
            ImageUtil.closeQuietly(src);
            //TODO Some codecs may do late reading.
View Full Code Here

                //remember the first exception, ignore all others and continue
                if (firstIOException == null) {
                    firstIOException = ioe;
                }
            } finally {
                reader.dispose();
                in.reset();
            }
        }

        if (iiometa == null) {
View Full Code Here

        try {
          reader.setInput(in);
          return new Dimension(reader.getWidth(0), reader.getHeight(0));
        }
        finally {
          reader.dispose();
        }
      }
      else {
        throw new IOException("can not create image");
      }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.