Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 4Gb 的文件。
path = "D:\Try\FourGBFile.txt"
说,
File file = new File(path);
我想将此文件的内容拆分为 4 个文件。我该怎么做?
获取文件长度:
long len = file.length();
打开FileInputStream你的源文件
FileInputStream
尽可能多FileOutputStream地打开你想要/需要
FileOutputStream
通过使用文件的长度从输入流中读取并写入相应的输出流来写入文件的每个部分