将输入流复制到文件
import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; /*来自 n o w j a v a . c o m - 时 代 Java*/ import java.net.URI; import java.nio.file.FileSystems; import java.nio.file.Files; import java.nio.file.Path; public class Main { public static void main(String[] args) { Path newFile = FileSystems.getDefault().getPath( "C:/home/docs/java7WebSite.html");/**来 自 n o w j a v a . c o m - 时代Java**/ URI url = URI.create("http://jdk7.java.net/"); try (InputStream inputStream = url.toURL().openStream()) { Files.copy(inputStream, newFile); System.out.println("Site copied successfully!")