1

我有一个 4Gb 的文件。

path = "D:\Try\FourGBFile.txt"

说,

File file = new File(path);

我想将此文件的内容拆分为 4 个文件。我该怎么做?

4

1 回答 1

0
  1. 获取文件长度:

    long len = file.length();
    
  2. 打开FileInputStream你的源文件

  3. 尽可能多FileOutputStream地打开你想要/需要

  4. 通过使用文件的长度从输入流中读取并写入相应的输出流来写入文件的每个部分

于 2014-08-04T09:00:33.203 回答