IO流自定义字符数组的拷贝。

Posted wangffeng293

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了IO流自定义字符数组的拷贝。相关的知识,希望对你有一定的参考价值。

public static void main(String[] args) throws IOException{

  FileRead fr = new FileRead ("xxx.txt");

  FileWrite fw = new FileWrite ("yyy.txt");

  char [] arr = new char[1024*8];

  int len;

  while((len = fr.read(arr)) != -1){  //将文件上的数据读取到字符数组中

    fw.write(arr,0,len);   //将字符数组中的数据写到文件上(从0开始读取,读取长度为len)

  }

  fr.close();

  fw.close();

}

以上是关于IO流自定义字符数组的拷贝。的主要内容,如果未能解决你的问题,请参考以下文章