Boa tarde pessoal,
Eu fiz esse metodo que recebe um arquivo zip e “converte em um array de byte” agora eu preciso pegar essa array e “converte-lo em um arquivo zip novamente” mas estou meio perdido.
Se alguem puder me dar uma dica eu agradeço?
public byte[] zipBytes(String filename) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
ZipInputStream zis = new ZipInputStream(new FileInputStream(filename));
int tamanho = (int) filename.length();
byte buf[] = new byte[tamanho];
//ZipEntry entry;
int read = 0;
while ((read = zis.read(buf, 0, buf.length)) != -1) {
baos.write(buf, 0, read);
}
baos.flush();
baos.close();
zis.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return baos.toByteArray();
}