private ImageOutputStream createImageOutputStream(OutputStream os) throws IOException { if (this.cacheDir != null) { return new FileCacheImageOutputStream(os, this.cacheDir); } else { return new MemoryCacheImageOutputStream(os); } }
private ImageOutputStream createImageOutputStream(OutputStream os) throws IOException { if (this.cacheDir != null) { return new FileCacheImageOutputStream(os, this.cacheDir); } else { return new MemoryCacheImageOutputStream(os); } }
/** * Builds a {@link ImageOutputStream} writing to <code>destination</code>, based on logic that * involves the image size * * @param image the image to be written on the destination (can be null) * @param destination the destination * @return * @throws IOException */ public static ImageOutputStream createImageOutputStream(RenderedImage image, Object destination) throws IOException { // already what we need? if (destination instanceof ImageOutputStream) { return (ImageOutputStream) destination; } // generate the ImageOutputStream if (destination instanceof OutputStream && filesystemThreshold != null && image != null) { OutputStream stream = (OutputStream) destination; // 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); } }
private ImageOutputStream createImageOutputStream(OutputStream os) throws IOException { if (this.cacheDir != null) { return new FileCacheImageOutputStream(os, this.cacheDir); } else { return new MemoryCacheImageOutputStream(os); } }
private ImageOutputStream createImageOutputStream(OutputStream os) throws IOException { if (this.cacheDir != null) { return new FileCacheImageOutputStream(os, this.cacheDir); } else { return new MemoryCacheImageOutputStream(os); } }
private ImageOutputStream createImageOutputStream(OutputStream os) throws IOException { if (this.cacheDir != null) { return new FileCacheImageOutputStream(os, this.cacheDir); } else { return new MemoryCacheImageOutputStream(os); } }
stream = new FileCacheImageOutputStream(outStream, cacheDir); } catch(IOException e) {
stream = new FileCacheImageOutputStream(outStream, cacheDir); } catch(IOException e) {
stream = new FileCacheImageOutputStream(outStream, cacheDir); } catch(IOException e) {
stream = new FileCacheImageOutputStream(outStream, cacheDir); } catch(IOException e) {
if (imageSize > filesystemThreshold) { File cacheDirectory = getCacheDirectory(); return new FileCacheImageOutputStream(stream, cacheDirectory); } else { return new MemoryCacheImageOutputStream(stream);