Хочу решить без Vector-а и SequenceInputStream. Возможно-ли? Если да, то где у меня ошибка и что я не учел?))
package com.javarush.task.task31.task3106;
import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.zip.ZipInputStream;
/*
Разархивируем файл
*/
public class Solution {
public static void main(String[] args) throws IOException {
List<String> files = new ArrayList<>();
Collections.addAll(files, args);
files.remove(files.get(0));
Collections.sort(files);
ByteArrayOutputStream byteArray = new ByteArrayOutputStream();
for (String s : files) {
FileInputStream fileInputStream = new FileInputStream(s);
byte[] b = new byte[fileInputStream.available()];
fileInputStream.read(b);
byteArray.write(b);
fileInputStream.close();
}
ZipInputStream in = new ZipInputStream(new ByteArrayInputStream(byteArray.toByteArray()));
FileOutputStream out = new FileOutputStream(new File(args[0]));
byte[] b = new byte[in.available()];
in.read(b);
out.write(b);
out.close();
in.close();
}
}