Check out the JavaDoc here
Also look at the Project Reports menu on the left for project specific items, unit tests, QA etc.
All examples are in the com.pz.reader.examples sub-directories. There is an application to run these, com.px.reader.examples.Examples but the easiest way is to run the run-examples.bat in the target directory after build via Maven:
Menu Options 1) CSVTestFileCreator 8) FixedLengthHeaderAndTrailer 2) CSVHeaderAndTrailer 9) LargeDelimitedWithPZMap 3) CSVPerformanceTest 10) LargeFixedLengthWithPZMap 4) DelimitedWithPZMap 11) CSVLarge 5) DelimitedWithPZMapErrors 12) LowLevelParse 6) DelimitedFileExportToExcel 13) DelimitedMultiLine 7) FixedLengthWithPZMap 14) NumericsAndDates 15) Who you gonna call? 0) Exit Enter your choice: (default:-1)
This utility can be used to create a sample CSV file for testing the parser. In the ExecuterSample.bat file, there are 2 parameters. param1 = # cols to make | param2 = #rows to make The following line would create a csv file with 10 columns and 100000 rows:
File Type: Comma Delimted With Text Qualified By "'s This shows the ability to parse header and trailer records out of a file.
File Type: Must Be A CSV file This is meant to be a performance test. The sample file contains 10 columns and 100,000 rows. Performance Tests ------------------------------ Machine Specs: P4 1.7 GHZ 256MB RAM | Parse Time: 45-48 secs. Machine Specs: P4 2.9 GHZ 1 GB RAM | Parse Time: 23-25 secs. Feel free to post additional performance tests in the SF forums :) There is a settings.properties file in this directory. This file has 2 different options: verbose - can be set to true/false. If set to true, the data in the file will be ran to the screen after the parse. There is a 2 second pause before data start to get spit to the screen. This is to allow the user to see the total time it took to parse the file. csvFile - set this to the path of the CSV file to be read in. Feel free to test this against your own CSV files. This particular example uses the first record in the file for the column names. Depending on the size of the file being parsed, the -Xmx parameter may need to be adjusted. This is the max memory setting for the JVM to use. This parameter is set in the ExecuteSample.bat file and is currently set to 128mb. This needs to be adjusted if OutOfMemory errors occur.
File Type: Comma Delimted With Text Qualified By "'s This sample uses the column names which are contained in the CSV file instead of relying on a mapping to tell the parser what the column names are. This sample also re-orders the file by CITY ASC, LASTNAME DESC There have also been " 's and , 's added to the text on one of the records to show the parsing abilities of the API.
File Type: Comma Delimted With Text Qualified By "'s This sample dynamically reads the column names from the DataSet and evaluates the values of each column. Making use of the getColumns() method. This sample also re-orders the file by CITY ASC, LASTNAME DESC There have also been " 's and , 's added to the text on one of the records to show the parsing abilities of the API.
File Type: Comma Delimted With Text Qualified By "'s This sample contains errors in the PEOPLE-CommaDelimitedWithQualifier.txt 2 Lines in the file contain more columns then we have declared in the PEOPLE-Delimited.pzmap.xml This demonstrates how to check for errors that happened while reading the file. This sample dynamically reads the column names from the DataSet and evaluates the values of each column. Making use of the getColumns() method. This sample also re-orders the file by CITY ASC, LASTNAME DESC There have also been " 's and , 's added to the text on one of the records to show the parsing abilities of the API.
File Type: Comma Delimted With Text Qualified By "'s This sample re-orders the file by CITY ASC, LASTNAME DESC and exports to "MyExcelExport.xls" There have also been " 's and , 's added to the text on one of the records to show the parsing abilities of the API.
File Type: Fixed Width Text This sample dynamically reads the column names from the DataSet and evaluates the values of each column. Making use of the getColumns() method. This sample also re-orders the file by CITY ASC, LASTNAME DESC
File Type: Fixed Width Text This sample dynamically reads the column names from the DataSet and evaluates the values of each column. Making use of the getColumns() method. This sample also re-orders the file by CITY ASC, LASTNAME DESC
File Type: Comma Delimted With Text Qualified By "'s This sample dynamically reads the column names from the LargeDataSet and evaluates the values of each column. Making use of the getColumns() method. There have also been " 's and , 's added to the text on one of the records to show the parsing abilities of the API.
File Type: Fixed Width Text This sample dynamically reads the column names from the DataSet and evaluates the values of each column. Making use of the getColumns() method. This sample also re-orders the file by CITY ASC, LASTNAME DESC
File Type: Must Be A CSV file This is meant to be a performance test for large files. This will make use of the new LargeDataSet class introduced in 2.2. A println will be run to the screen for every 2500 records parsed and looped through in the file. This class differs from the DataSet class where the file is no longer read into memory. There is a settings.properties file in this directory. csvFile - set this to the path of the CSV file to be read in. Feel free to test this against your own CSV files. This particular example uses the first record in the file for the column names. Depending on the size of the file being parsed, the -Xmx parameter may need to be adjusted. This is the max memory setting for the JVM to use. This parameter is set in the ExecuteSample.bat file and is currently set to 128mb. This needs to be adjusted if OutOfMemory errors occur.
File Type: Comma Delimted With Text Qualified By "'s This demonstrates how to perform lower level parsing. The DataSet class is bypassed alltogether and a buffered reader is used instead. This sample makes use of parsing utilities which are provided through the ParserUtils class.
File Type: Comma Delimted With Text Qualified By "'s This sample dynamically reads the column names from the DataSet and evaluates the values of each column. Making use of the getColumns() method. This sample also re-orders the file by CITY ASC, LASTNAME DESC There have also been " 's and , 's added to the text on one of the records to show the parsing abilities of the API.