Не пойму вообще ничего. Поток FileInputStream, FileOutputStream использую, а валидатор все равно ругается.
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
String n1 = r.readLine();
String n2 = r.readLine();
String n3 = r.readLine();
r.close();
FileInputStream f1 = new FileInputStream(n1);
FileOutputStream f2 = new FileOutputStream(n2);
FileOutputStream f3 = new FileOutputStream(n3);
long f1Size = f1.getChannel().size();
long f2Size = f1Size / 2 + f1Size % 2;
long f3Size = f1Size - f2Size;
byte[] b2 = new byte[(int) f2Size];
byte[] b3 = new byte[(int) f3Size];
f1.read(b2,0, (int) f2Size);
f2.write(b2);
f1.read(b3, 0, (int) f3Size);
f3.write(b3);
f1.close();
f2.close();
f3.close();
}
}
package com.javarush.task.task18.task1808;
/*
Разделение файла
*/
import java.io.BufferedReader;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.FileInputStream;
public class Solution {
public static void main(String[] args) throws IOException, IOException {
BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
String n1 = r.readLine(); // C:\Users\kosty\Desktop\temp.txt
String n2 = r.readLine();
String n3 = r.readLine();
r.close();
FileInputStream f1 = new FileInputStream(n1);
FileOutputStream f2 = new FileOutputStream(n2);
FileOutputStream f3 = new FileOutputStream(n3);
long f1Size = f1.getChannel().size();
long f2Size = f1Size / 2 + f1Size % 2;
long f3Size = f1Size - f2Size;
byte[] b2 = new byte[(int) f2Size];
byte[] b3 = new byte[(int) f3Size];
// System.out.println(f1Size + " " + f2Size + " " + f3Size );
f1.read(b2,0, (int) f2Size);
f2.write(b2);
f1.read(b3, 0, (int) f3Size);
f3.write(b3);
f1.close();
f2.close();
f3.close();
}
}