用一次读写一个字节数组来复制音频文件

mac2024-08-17  67

File file = new File("G:\\oracle视频\\韩顺平.玩转oracle第0讲.开山.wmv"); FileInputStream in = new FileInputStream(file); FileOutputStream out = new FileOutputStream("C:\\Users\\Administrator\\Desktop\\test\\" +"\\"+ file.getName()); int len=0;//记录读取到的有效字节个数 //创建一个字节数组,充当缓冲区字节数组 byte[] bytes = new byte[1024*8]; while ((len=in.read(bytes))!=-1){ System.out.println("次数"); out.write(bytes,0,len); out.flush(); } //释放资源 out.close(); in.close(); System.out.println("复制完成");
最新回复(0)