import
java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Main {
public static void main(String[] args) throws IOException {
String path = "/Users/ssss/Downloads/Files (1)/";
List<String> lines = Files.readAllLines(Path.of(path + "splitlog.txt"));
Map<Integer, InputStream> inputMap = new HashMap(){{
put(0, new FileInputStream(path + "p1"));
put(1, new FileInputStream(path + "p2"));
put(2, new FileInputStream(path + "p3"));
}};
OutputStream out = new FileOutputStream(path + "out.jpg");
for (String line : lines) {
String[] tmps = line.split("\t");
int fileN = Integer.parseInt(tmps[0]);
int byteN = Integer.parseInt(tmps[1]);
out.write(inputMap.get(fileN).readNBytes(byteN));
}
out.close();
}
}