I have pdf file in byte[] array. I want to compress it and encrypt with password. I don't want to create any temp files. But libraries like zip4j, winzipaes doesn't support it. They accept only File objects.
EDIT: code for simple zip:
public static byte[] zipBytes(String filename, byte[] input) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ZipOutputStream zos = new ZipOutputStream(baos);
ZipEntry entry = new ZipEntry(filename);
entry.setSize(input.length);
zos.putNextEntry(entry);
zos.write(input);
zos.closeEntry();
zos.close();
return baos.toByteArray();}
How add encryption and password?