JAVA byte stream exercise _ copy and paste of files

Copy and paste of files

public class demo03 {
    
    
    public static void main(String[] args) throws IOException {
    
    
        double start = System.nanoTime();
        FileInputStream fis = new FileInputStream("09_IOAndProperties\\src\\com\\itheima\\demo02\\InputStream\\Demo02InputStream.java");
        FileOutputStream fos = new FileOutputStream("09_IOAndProperties\\src\\com\\itheima\\demo02\\InputStream\\x.java");
        byte[] bytes= new byte[1024];
        int read = fis.read(bytes);
        fos.write(bytes,0,read);
        double end = System.nanoTime();
        System.out.println("共"+(end-start)+"毫秒");
        fis.clse();
        fos.close();
    }
}

Guess you like

Origin blog.csdn.net/TOPic666/article/details/107960663