public static void Main (String args[]) throws Exception {
if (Args.length < 1) {
System.exit (0);
}
System.out.println (Args[0]);
Bufferedinputstream Bufferedinputstream = new Bufferedinputstream (new FileInputStream (New File (args[0)));
int filecount = 0;
byte[] input = new byte[4096];
int len = 0;
while (len = bufferedinputstream.read (input))! =-1) {
byte[] Get = arrays.copyofrange (input, 0, Len);//Copy from input array to get array, len length
String flag = "";
if (FileCount < 10) {
Flag = "$" + filecount;
} else if (FileCount < 100) {
Flag = "XX" + filecount;
} else if (FileCount < 1000) {
Flag = "0" + filecount;
}
FileOutputStream FileOutputStream = new FileOutputStream (New File ("x" + flag);
Fileoutputstream.write (get);//If input is written directly, the total MD5 is inconsistent with the actual, because the last piece of length is not necessarily 4k
Fileoutputstream.close ();
filecount++;
}
Bufferedinputstream.close ();
New String ();
}
Java Split File Considerations