从Internet URL复制到本地文件
import java.io.IOException; /* 时 代 J a v a - nowjava.com 提供 */ import java.io.InputStream; import java.net.URI; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; public class Main { public static void main(String[] args) throws Exception { Path copy_to = Paths.get("C:/folder1/photos/test.jpg"); URI u = URI.create("https://nowjava.com/fake.jpg"); try (InputStream in = u.toURL().openStream()) { /**来自 时 代 J a v