Package javax.imageio.stream

Examples of javax.imageio.stream.FileCacheImageInputStream


                        float lrlon = ((Double) record.get(lrlonIndex)).floatValue();
                        imageURLString = (String) record.get(urlIndex);

                        URL imageURL = PropUtils.getResourceOrFileOrURL(imageURLString);

                        FileCacheImageInputStream fciis = new FileCacheImageInputStream(imageURL.openStream(), null);
                        BufferedImage fileImage = ImageIO.read(fciis);

                        // ImageIcon ii = new ImageIcon(imageURL);
                        // Image fileImage = ii.getImage();
View Full Code Here


        }
        return null;
    }

    public static BufferedImage getImageIOImage(URL fileURL) throws IOException {
        FileCacheImageInputStream fciis = new FileCacheImageInputStream(fileURL.openStream(), null);
        BufferedImage fileImage = ImageIO.read(fciis);
        return fileImage;
    }
View Full Code Here

    public DefaultSeekableInputStream(
        CloseListener close, InputStream is, boolean useFile)
        throws IOException {
        this.closer = close;
        if (useFile) {
            delegatee = new FileCacheImageInputStream(
                is, new File(System.getProperty(TMP_DIR_PROPERTY_KEY)));
        } else {
            delegatee = new MemoryCacheImageInputStream(is);
        }
    }
View Full Code Here

        throws IOException {
        if (input instanceof InputStream) {
            InputStream is = (InputStream)input;

            if (useCache) {
                return new FileCacheImageInputStream(is, cacheDir);
            } else {
                return new MemoryCacheImageInputStream(is);
            }
        } else {
            throw new IllegalArgumentException();
View Full Code Here

    }
  }

  private ImageInputStream createImageInputStream(InputStream is) throws IOException {
    if (this.cacheDir != null) {
      return new FileCacheImageInputStream(is, cacheDir);
    }
    else {
      return new MemoryCacheImageInputStream(is);
    }
  }
View Full Code Here

        throws IOException {
        if (input instanceof InputStream) {
            InputStream is = (InputStream)input;

            if (useCache) {
                return new FileCacheImageInputStream(is, cacheDir);
            } else {
                return new MemoryCacheImageInputStream(is);
            }
        } else {
            throw new IllegalArgumentException();
View Full Code Here

                throw new JXAException(src + " cannot be read");
            }
            raf = new RandomAccessFile(inputFile, "r");
            is = JXAenvUtils2.__getBuffered(new FileInputStream(raf.getFD()), bigBuffer);
            if (useCache) {
                r.setInput(new FileCacheImageInputStream(is, tmpDir));
            } else {
                r.setInput(ImageIO.createImageInputStream(is));
            }
        } else if (src instanceof ImageInputStream) {
            r.setInput(src);
        } else if (src instanceof InputStream) {
            is = JXAenvUtils2.__getBuffered((InputStream) src, bigBuffer);
            if (useCache) {
                r.setInput(new FileCacheImageInputStream(is, tmpDir));
            } else {
                r.setInput(ImageIO.createImageInputStream(is));
            }
        } else if (src instanceof String) {
            if (!src.equals(NO_SOURCE)) {
                if (!isExtClassLoaderRes()) {
                    is = JXAenvUtils2.__getBuffered(Sprite.class.getResourceAsStream((String) src), bigBuffer);
                } else {
                    is = JXAenvUtils2.__getBuffered(ExtensionsClassLoader.getInstance().getClassLoader().getResourceAsStream(_contextResource((String) src)), bigBuffer); /*
                     * Thread.currentThread().getContextClassLoader().getResourceAsStream(_contextResource((String)
                     * src));
                     */

                }
                if (useCache) {
                    r.setInput(new FileCacheImageInputStream(is, tmpDir));
                } else {
                    r.setInput(ImageIO.createImageInputStream(is));
                }
            } else {
                throw new JXAException("reading is not supported from " + src);
            }
        } else if (src instanceof File) {
            raf = new RandomAccessFile((File) src, "r");
            is = JXAenvUtils2.__getBuffered(new FileInputStream(raf.getFD()), bigBuffer);
            if (useCache) {
                r.setInput(new FileCacheImageInputStream(is, tmpDir));
            } else {
                r.setInput(ImageIO.createImageInputStream(is));
            }
        } else {
            throw new JXAException(src.getClass() + " input is not supported");
View Full Code Here

                break;
            case INPUT_URL:
                origStream = ((URL)input).openStream();
                bis = new BufferedInputStream(origStream);
                if (ImageIO.getUseCache()) {
                    iis = new FileCacheImageInputStream(bis, null);
                } else {
                    iis = new MemoryCacheImageInputStream(bis);
                }
                break;
            case INPUT_ARRAY:
                origStream = new ByteArrayInputStream((byte[])input);
                bis = new BufferedInputStream(origStream);
                if (ImageIO.getUseCache()) {
                    iis = new FileCacheImageInputStream(bis, null);
                } else {
                    iis = new MemoryCacheImageInputStream(bis);
                }
                break;
            case INPUT_FILECHANNEL:
View Full Code Here

    //
    // //
    if (input instanceof InputStream) {
      closeMe = false;
      if (ImageIO.getUseCache())
        inStream = new FileCacheImageInputStream((InputStream) input,
            null);
      else
        inStream = new MemoryCacheImageInputStream((InputStream) input);
      // let's mark it
      inStream.mark();
View Full Code Here

        throws IOException {
        if (input instanceof InputStream) {
            InputStream is = (InputStream)input;

            if (useCache) {
                return new FileCacheImageInputStream(is, cacheDir);
            } else {
                return new MemoryCacheImageInputStream(is);
            }
        } else {
            throw new IllegalArgumentException();
View Full Code Here

TOP

Related Classes of javax.imageio.stream.FileCacheImageInputStream

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.