1. 程式人生 > >【複製文字檔案:使用絕對路徑複製檔案】

【複製文字檔案:使用絕對路徑複製檔案】

package test;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * @author shusheng
 * @description 使用絕對路徑複製檔案
 * @Email [email protected]
 * @date 2018/11/9 17:23
 */
public class CopyFileDemo2 {

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

        FileInputStream fis 
= new FileInputStream("C:\\Users\\shusheng\\Pictures\\110.jpg"); FileOutputStream fos = new FileOutputStream("C:\\Users\\shusheng\\Pictures\\111.jpg"); int by = 0; while((by=fis.read())!=-1){ fos.write(by); } fis.close(); fos.close(); } }