Package javax.imageio.stream

Examples of javax.imageio.stream.FileCacheImageOutputStream


                                                        File cacheDir)
        throws IOException {
        if (output instanceof OutputStream) {
            OutputStream os = (OutputStream)output;
            if (useCache) {
                return new FileCacheImageOutputStream(os, cacheDir);
            } else {
                return new MemoryCacheImageOutputStream(os);
            }
        } else {
            throw new IllegalArgumentException();
View Full Code Here


    }
  }

  private ImageOutputStream createImageOutputStream(OutputStream os) throws IOException {
    if (this.cacheDir != null) {
      return new FileCacheImageOutputStream(os, this.cacheDir);
    }
    else {
      return new MemoryCacheImageOutputStream(os);
    }
  }
View Full Code Here

                                                        File cacheDir)
        throws IOException {
        if (output instanceof OutputStream) {
            OutputStream os = (OutputStream)output;
            if (useCache) {
                return new FileCacheImageOutputStream(os, cacheDir);
            } else {
                return new MemoryCacheImageOutputStream(os);
            }
        } else {
            throw new IllegalArgumentException();
View Full Code Here

        if (dst instanceof String) {
            File outputFile = new File((String) dst);
            raf = new RandomAccessFile(outputFile, "rw");
            os = JXAenvUtils2.__getBuffered(new FileOutputStream(raf.getFD()), bigBuffer);
            if (useCache) {
                w.setOutput(new FileCacheImageOutputStream(os, tmpDir));
            } else {
                w.setOutput(ImageIO.createImageOutputStream(os));
            }
        } else if (dst instanceof OutputStream) {
            os = JXAenvUtils2.__getBuffered((OutputStream) dst, bigBuffer);
            if (useCache) {
                w.setOutput(new FileCacheImageOutputStream(os, tmpDir));
            } else {
                w.setOutput(ImageIO.createImageOutputStream(os));
            }
        } else if (dst instanceof File) {
            raf = new RandomAccessFile((File) dst, "rw");
            os = JXAenvUtils2.__getBuffered(new FileOutputStream(raf.getFD()), bigBuffer);
            if (useCache) {
                w.setOutput(new FileCacheImageOutputStream(os, tmpDir));
            } else {
                w.setOutput(ImageIO.createImageOutputStream(os));
            }
        } else if (dst instanceof ImageOutputStream) {
            w.setOutput(dst);
View Full Code Here

                break;
            case OUTPUT_ARRAY:
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                BufferedOutputStream bos = new BufferedOutputStream(baos);
                if (ImageIO.getUseCache()) {
                    ios = new FileCacheImageOutputStream(bos, null);
                } else {
                    ios = new MemoryCacheImageOutputStream(bos);
                }
                break;
            case OUTPUT_FILECHANNEL:
View Full Code Here

    @Override
    public ImageOutputStream createOutputStreamInstance(Object output, boolean useCache, File cacheDir) throws IOException {
        if (output instanceof OutputStream) {
            if (useCache) {
                return new FileCacheImageOutputStream((OutputStream) output, cacheDir);
            } else {
                return new MemoryCacheImageOutputStream((OutputStream) output);
            }
        }
        throw new IllegalArgumentException(Messages.getString("imageio.85"));
View Full Code Here

    @Override
    public ImageOutputStream createOutputStreamInstance(Object output, boolean useCache, File cacheDir) throws IOException {
        if (output instanceof OutputStream) {
            if (useCache) {
                return new FileCacheImageOutputStream((OutputStream) output, cacheDir);
            } else {
                return new MemoryCacheImageOutputStream((OutputStream) output);
            }
        }
        throw new IllegalArgumentException("Output is not an instance of OutputStream");
View Full Code Here

    }
  }

  private ImageOutputStream createImageOutputStream(OutputStream os) throws IOException {
    if (this.cacheDir != null) {
      return new FileCacheImageOutputStream(os, this.cacheDir);
    }
    else {
      return new MemoryCacheImageOutputStream(os);
    }
  }
View Full Code Here

            // if going to wrap a output stream and we have a threshold set
            long imageSize = computeImageSize(image);
            if (imageSize > filesystemThreshold) {
                File cacheDirectory = getCacheDirectory();
                return new FileCacheImageOutputStream(stream, cacheDirectory);
            } else {
                return new MemoryCacheImageOutputStream(stream);
            }
        } else {
            return ImageIO.createImageOutputStream(destination);
View Full Code Here

                                                        File cacheDir)
        throws IOException {
        if (output instanceof OutputStream) {
            OutputStream os = (OutputStream)output;
            if (useCache) {
                return new FileCacheImageOutputStream(os, cacheDir);
            } else {
                return new MemoryCacheImageOutputStream(os);
            }
        } else {
            throw new IllegalArgumentException();
View Full Code Here

TOP

Related Classes of javax.imageio.stream.FileCacheImageOutputStream

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.