I\'m trying to zip a file (for example foo.csv) and upload it to a server. I have a working version which creates a local copy and then deletes the local copy. How would I
nifi MergeContent contain compressZip code
commons-io
public byte[] compressZip(ByteArrayOutputStream baos,String entryName) throws IOException {
try (final ByteArrayOutputStream zipBaos = new ByteArrayOutputStream();
final java.util.zip.ZipOutputStream out = new ZipOutputStream(zipBaos)) {
final ZipEntry zipEntry = new ZipEntry(entryName);
zipEntry.setSize(baos.size());
out.putNextEntry(zipEntry);
IOUtils.copy(new ByteArrayInputStream(baos.toByteArray()), out);
out.closeEntry();
out.finish();
out.flush();
return zipBaos.toByteArray();
}
}