I have a 4Gb file.
path = "D:\Try\FourGBFile.txt"
Say,
File file = new File(path);
I wanna split the contents of this file into 4 files. How would i do it?
I have a 4Gb file.
path = "D:\Try\FourGBFile.txt"
Say,
File file = new File(path);
I wanna split the contents of this file into 4 files. How would i do it?
Get the length of the file:
long len = file.length();
Open a FileInputStream
to your source file
Open as many FileOutputStream
as you want/need
Write each part of the file by reading from the input stream and writing to the respective output stream, using the length of the file