@Override public File getResourceAsFile(String resource) throws IOException { String name = (new File(resource)).getName(); if (name.isEmpty()) { throw new IOException("Invalid resource name: " + resource); } File extractedFile = new File(getTemporaryDirectory("resource_extraction_", Lifetimes.moeExecution()), name); makeDirsForFile(extractedFile); OutputStream os = Files.asByteSink(extractedFile).openStream(); Resources.copy(SystemFileSystem.class.getResource(resource), os); os.close(); return extractedFile; }
@Override public File getTemporaryDirectory(String prefix) { return getTemporaryDirectory(prefix, Lifetimes.currentTask()); }