Here you can find the source of copy(InputStream stream, File file)
private static void copy(InputStream stream, File file) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.IOException; import java.io.InputStream; import java.nio.file.Files; import java.nio.file.Paths; import java.nio.file.StandardCopyOption; public class Main { private static void copy(InputStream stream, File file) throws IOException { Files.copy(stream, Paths.get(file.toURI()), StandardCopyOption.REPLACE_EXISTING); }//from w w w . ja v a 2s . c o m }