集册 Java实例教程 从输入流复制到文件

从输入流复制到文件

欢马劈雪     最近更新时间:2020-01-02 10:19:05

524
从输入流复制到文件

import java.io.FileInputStream;/**from 时 代 J a v a - N o w J a v a . c o m**/

import java.io.IOException;

import java.io.InputStream;

import java.nio.file.Files;

import java.nio.file.Path;

import java.nio.file.Paths;

import java.nio.file.StandardCopyOption;


public class Main {

  public static void main(String[] args) throws Exception {

    Path copy_from = Paths.get("C:/folder1/folder0/folder9",

        "draw_template.txt");

    Path copy_to = Paths.get("C:/folder1/folder0/folder8",// 来自 nowjava - 时  代  Java

        "draw_template.txt");


    try (InputStream is = new FileInputStream(copy_from
展开阅读全文