```java
 private static void copy(JarFile jar, JarEntry from, File to) throws IOException {
        try(InputStream is = jar.getInputStream(from);
            FileOutputStream os = new FileOutputStream(to)) {
            IOUtils.copy(is, os);
        }
    }
```