List of usage examples for javax.imageio.stream FileCacheImageInputStream FileCacheImageInputStream
public FileCacheImageInputStream(InputStream stream, File cacheDir) throws IOException
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); } }