JAVA字节流练习_文件的复制粘贴

文件的复制粘贴

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();
    }
}

猜你喜欢

转载自blog.csdn.net/TOPic666/article/details/107960663