List of usage examples for javax.imageio ImageIO setCacheDirectory
public static void setCacheDirectory(File cacheDirectory)
From source file:com.vns.pdf.impl.PdfDocument.java
private void setWorkingDir() throws IOException { ApplicationProperties.KEY.PdfDir.asString(); workingDir = Paths.get(ApplicationProperties.KEY.PdfDir.asString()); Files.createDirectories(workingDir, new FileAttribute[0]); pdfTempDir = Paths.get(ApplicationProperties.KEY.Workspace.asString(), "temp"); if (!Files.exists(pdfTempDir, LinkOption.NOFOLLOW_LINKS)) { Files.createDirectories(pdfTempDir); }//from www . j a va 2 s . c om ImageIO.setCacheDirectory(pdfTempDir.toFile()); ImageIO.setUseCache(true); }
From source file:org.nuxeo.launcher.gui.NuxeoFrame.java
protected ImageIcon getImageIcon(String resourcePath) { BufferedImage image = null;//from w ww .jav a 2 s . c o m try { ImageIO.setCacheDirectory(Environment.getDefault().getTemp()); image = ImageIO.read(getClass().getClassLoader().getResource(resourcePath)); } catch (IOException e) { log.error(e); } return new ImageIcon(image); }