How to copy a resource to a file in another location in Java
<p>I'm trying to copy a resource in my project onto another location on the disk. So far, I have this code:</p>

<pre><code>if (!file.exists()){
    try {
        file.createNewFile();
        Files.copy(new InputSupplier&lt;InputStream&gt;() {
            public InputStream getInput() throws IOException {
                return Main.class.getResourceAsStream("/" + name);
            }
        }, file);                   
    } catch (IOException e) {
        file = null;
        return null;
    }
}
</code></pre>

<p>And it works fine, but the <code>InputSupplier</code> class is deprecated, so I was wondering if there was a better way to do what I'm trying to do.</p>