Example usage for javax.imageio ImageIO setCacheDirectory

List of usage examples for javax.imageio ImageIO setCacheDirectory

Introduction

In this page you can find the example usage for javax.imageio ImageIO setCacheDirectory.

Prototype

public static void setCacheDirectory(File cacheDirectory) 

Source Link

Document

Sets the directory where cache files are to be created.

Usage

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);
}