How to create temp directory?

Six Stars

How to create temp directory?

I have the task of decompressing a zip file and plan to use Java's Zip4j but I need a temp directory to extract it to while I parse the file. I saw the tFileList component but I'm not sure how to reference a directory on the server that the Talend job is deployed to in order to use it. Is there a default temp dir that I could use for this purpose?

Fifteen Stars TRF
Fifteen Stars

Re: How to create temp directory?

Hi,

Any reason to not use tFileUnarchive component?


TRF
Highlighted
Six Stars

Re: How to create temp directory?

To be honest I didn't know about it. This is what I ended up with though. I don't know how it compares to the tFileUnarchive, but it it's exactly what I needed since I am parsing the file manually anyway. Thanks for the heads up tFileUnarchive.

 

ZipInputStream zis = new ZipInputStream((InputStream)globalMap.get("tFileFetch_1_INPUT_STREAM"));
InputStream is = null;

ZipEntry entry;
while ((entry = zis.getNextEntry()) != null)
{
	if (entry.getName().equals(fileName)) {		
    		is = (InputStream)zis;
    		break;
    }
}

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

An API-First Approach to Modernizing Applications

Learn how to use an API-First Approach to Modernize your Applications

Watch Now

Talend API Designer – Technical Overview

Take a look at this technical overview video of Talend API Designer

Watch Now

Getting Started with APIs

Find out how to get started with APIs

Read