写入写出文件

/*
             * 将d盘测试.docx
             * 写出到 d盘 创建csc.docx
             */
        
            FileInputStream in = new FileInputStream("/D:/测试.docx");
            
            FileOutputStream out = new FileOutputStream("/D:/测试/csc.docx");
            int len;
            byte[] buf = new byte[1024];

//每读一行,就写出一行
            while((len = in.read(buf))!= -1){
                out.write(buf, 0, len);
            }
            in.close();
            out.flush();
            out.close();

你可能感兴趣的:(写入写出文件)