Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void transferDashboardTool(String destination) throws IOException {
- final String resourcePath = "classpath:dashboard/dashboard.zip";
- File file = new File(Paths.get(System.getProperty("java.io.tmpdir"), "tmp.zip").toString());
- FileUtils.copyInputStreamToFile(resourceLoader.getResource(resourcePath).getInputStream(), file);
- ZipFile zipFile = new ZipFile(file);
- zipFile.extractAll(destination);
- }
- // points
- // 1. make sure you are using resource.getInputStream() not resource.getFile() when loading from inside a jar file
- // 2. how to get a temporary folder
- // 3. how to convert InputStream to File with Apache common.io
- // 4. how to unzip file using zip4j (http://www.lingala.net/zip4j.html) library
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement