Example usage for javax.imageio.stream FileCacheImageInputStream FileCacheImageInputStream

List of usage examples for javax.imageio.stream FileCacheImageInputStream FileCacheImageInputStream

Introduction

In this page you can find the example usage for javax.imageio.stream FileCacheImageInputStream FileCacheImageInputStream.

Prototype

public FileCacheImageInputStream(InputStream stream, File cacheDir) throws IOException 

Source Link

Document

Constructs a FileCacheImageInputStream that will read from a given InputStream .

Usage

From source file:Main.java

private static ImageInputStream getResourceAsStream(Class<?> aClass, String name) throws IOException {
    final InputStream is = aClass.getResourceAsStream(name);

    if (is == null) {
        throw new IOException(MessageFormat.format("resource {0} not found", name));
    }//w w  w  . j av a  2  s .  c om
    return new FileCacheImageInputStream(is, null);
}

From source file:jails.http.converter.BufferedImageHttpMessageConverter.java

private ImageInputStream createImageInputStream(InputStream is) throws IOException {
    if (this.cacheDir != null) {
        return new FileCacheImageInputStream(is, cacheDir);
    } else {/*  ww  w . ja  v a 2  s.  co m*/
        return new MemoryCacheImageInputStream(is);
    }
}