1.BufferedCopy写法:
BufferedInputStream bis= new BufferedInputStream(fis);
BufferedOutputStream bos = new BufferedOutputStream(fos); 相当于:byte[] arr = new byte[8192];
bis.close();
bos.close();
int b = 0;
while(())
2.定义小数组copy写法:
FileInputSream fis = new FileInputStream("xxx.tex"); //创建流对象
FileOutputSream fos = new FileOutputSream("xxx2.text");
byte[] arr = new byte[1024]; //定义一个小数组
int length; //读取到的有效的字节个数
while((length = fis.read(arr))!=-1){fos.write(arr,0,length)}
fis.close(); 忘记写arr的话,读取的是码表值
fos.close();
|
|