PowerCenter
- PowerCenter H2L
- All Products
Port Name
| Datatype
| Precision
|
---|---|---|
FilePath
| string
| 1000
|
Delimiter
| string
| 10
|
import java.io.FileReader; import java.util.List; import org.supercsv.cellprocessor.Optional; import org.supercsv.cellprocessor.ParseBool; import org.supercsv.cellprocessor.ParseDate; import org.supercsv.cellprocessor.ParseInt; import org.supercsv.cellprocessor.constraint.*; import org.supercsv.cellprocessor.ift.CellProcessor; import org.supercsv.io.CsvListReader; import org.supercsv.io.ICsvListReader; import org.supercsv.prefs.CsvPreference;
ICsvListReader listReader = null; try{ final CsvPreference CUSTOM_DELIMITED = new CsvPreference.Builder('"',Delimiter.charAt(0), "\n").build(); listReader = new CsvListReader(new FileReader(FilePath), CUSTOM_DELIMITED); //listReader.getHeader(false); // skip the header (can't be used with CsvListReader) List<String> customerList; int numCols=grp.getOutputFieldList().size(); while( (customerList = listReader.read()) != null ) { for(int i=1;i<=numCols;i++){ if(i<=listReader.length()&&listReader.get(i)!=null) outputBuf.setString(outRowNum, i-1, listReader.get(i)); else outputBuf.setNull(outRowNum, i-1); } incrementOutputRowNumber(); flushBufWhenFull(); clearNullColSet(); } }catch(Exception e){ failSession("Could not read or open the specified file. Or, port could not hold the data. Check the size of the port or the specified delimiter."); }
JMS Application Source Qualifier Transformation Output Port
| Java Transformation Input Port
|
---|---|
BodyText
| FilePath
|
FlatFileDelimiter
| Delimiter
|