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

从文件复制到输出流

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

488
从文件复制到输出流

import java.io.FileOutputStream;/* 来自 nowjava.com*/

import java.io.IOException;

import java.io.OutputStream;

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_from = Paths.get("C:/folder1/folder0/folder9",

        "draw_template.txt");

    Path copy_to = Paths.get("C:/folder1/folder0/folder8",

        "draw_template.txt");


    try (OutputStream os = new FileOutputStream(copy_to.toFil
展开阅读全文