Hello dear Vertx Community,
I want ot ZIP files suing the java.util.zip like code sample below:
------------------------------
String sourceFile = "test1.txt";
FileOutputStream fos = new FileOutputStream("compressed.zip");
ZipOutputStream zipOut = new ZipOutputStream(fos);
File fileToZip = new File(sourceFile);
FileInputStream fis = new FileInputStream(fileToZip);
ZipEntry zipEntry = new ZipEntry(fileToZip.getName());
zipOut.putNextEntry(zipEntry);
byte[] bytes = new byte[1024];
int length;
while((length = fis.read(bytes)) >= 0) {
zipOut.write(bytes, 0, length);
}
zipOut.close();
fis.close();
fos.close();
------------------------------------------------------------
How to perform the I/O operation (write to file) Asynchronously (with EventLoop Thread)?
- - Is there a way to ZIP files using ONLY Vertx toolbox?
- - Is there a way to "bridge" java.io.OutputStream for ZipOutputStream to io.vertx.core.streams.WriteStrea of io.vertx.core.file.AsyncFile?
- Else, Should I use a WorkerThread to perform this Synchronous operation?
Thanks,
David