You don't actually have to unzip to a file system to do what you want, assuming that the zip file is the input data to the JCN (presumably as a BLOB).
The java.util.zip package can be used to process the file, only really unzipping the csv files you want to process. The JCN can then propagate the CSV data out to a MQOutput node to output the data to a queue.
It would be something like this:
1. Create ByteArrayInputStream from BLOB input
2. Create ZipInputStream from ByteArrayInputStream
3. Loop:
3.1. getNextEntry() from ZipInputStream
3.2. If getName() matches *.csv:
3.2.1. Create ByteArrayOutputStream to receive data, and bytes buffer for data
3.2.2. Loop:
3.2.2.1. read() from ZipInputStream into bytes buffer
3.2.2.2. Write bytes buffer to ByteArrayOutputStream
3.2.2.3. Until length read == 0
3.2.3. Convert ByteArrayOutputStream to BLOB
3.2.4. Create OutputRoot for BLOB
3.2.5. Propagate (presumably to MQOutput, but doesn't matter to JCN)
3.3. closeEntry() to go to next one
3.4. Until no next entry exists
3.5. Close ZipInputStream & ByteArrayInputStream
If you google Java Zip, there are lots of samples out there.
------------------------------
Tony Hays
Senior IT Architect
IBM Global Services
Spokane WA
706-305-8487
------------------------------
Original Message:
Sent: Wed June 29, 2022 02:28 AM
From: Tlabo Justice Theledi
Subject: Java Compute Node to Unzip multiple files
Hi,
I have requirement to unzip multiples in a directory using ACE toolkit, search for csv files within the directory and send them to the queue. I never done this before but i know is possible to do.
Please share some approach and resolution around this.
Thanks
Warm Regards
Justice
------------------------------
Tlabo Justice Theledi
------------------------------