Here is a Processor that works on ZIP files:
import org.apache.camel.util.ExchangeHelper;
import org.apache.camel.util.IOHelper;
public class ZipFileSplittingProcessor implements Processor {
public void process(Exchange exchange) throws Exception {
InputStream is = ExchangeHelper.getMandatoryInBody(exchange,
InputStream.class);
ZipInputStream zis = new ZipInputStream(new
BufferedInputStream(is));
exchange.getIn().setBody(getUncompressedZipEntries(zis));
}
private Collection<String> getUncompressedZipEntries(ZipInputStream zis)
throws Exception {
Collection<String> entries = new ArrayList<String>();
while (zis.getNextEntry() != null) { // Process each entry
ByteArrayOutputStream bos = new ByteArrayOutputStream();
IOHelper.copy(zis, bos);
entries.add(bos.toString());
}
zis.close();
return entries;
}
}
--
View this message in context:
http://camel.465427.n5.nabble.com/FTP-to-HDFS-large-gzipped-files-tp3192431p4383828.html
Sent from the Camel - Users mailing list archive at Nabble.com.