1 package org.apache.turbine.util;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 import java.io.Reader;
20
21 import java.util.List;
22
23 /***
24 * CSVParser is used to parse a stream with comma-separated values and
25 * generate ParameterParser objects which can be used to
26 * extract the values in the desired type.
27 *
28 * <p>The class extends the abstract class DataStreamParser and implements
29 * initTokenizer with suitable values for CSV files to provide this
30 * functionality.
31 *
32 * <p>The class (indirectly through DataStreamParser) implements the
33 * java.util.Iterator interface for convenience.
34 * This allows simple use in a Velocity template for example:
35 *
36 * <pre>
37 * #foreach ($row in $csvfile)
38 * Name: $row.Name
39 * Description: $row.Description
40 * #end
41 * </pre>
42 *
43 * @author <a href="mailto:sean@informage.net">Sean Legassick</a>
44 * @author <a href="mailto:martin@mvdb.net">Martin van den Bemt</a>
45 * @version $Id: CSVParser.java 264148 2005-08-29 14:21:04Z henning $
46 * @deprecated Use org.apache.turbine.util.parser.CSVParser instead.
47 */
48 public class CSVParser
49 extends org.apache.turbine.util.parser.CSVParser
50 {
51 /***
52 * Create a new CSVParser instance. Requires a Reader to read the
53 * comma-separated values from. The column headers must be set
54 * independently either explicitly, or by reading the first line
55 * of the CSV values.
56 *
57 * @param in the input reader.
58 */
59 public CSVParser(Reader in)
60 {
61 super(in, null, null);
62 }
63
64 /***
65 * Create a new CSVParser instance. Requires a Reader to read the
66 * comma-separated values from, and a list of column names.
67 *
68 * @param in the input reader.
69 * @param columnNames a list of column names.
70 */
71 public CSVParser(Reader in, List columnNames)
72 {
73 super(in, columnNames, null);
74 }
75
76 /***
77 * Create a new CSVParser instance. Requires a Reader to read the
78 * comma-separated values from, a list of column names and a
79 * character encoding.
80 *
81 * @param in the input reader.
82 * @param columnNames a list of column names.
83 * @param characterEncoding the character encoding of the input.
84 */
85 public CSVParser(Reader in, List columnNames, String characterEncoding)
86 {
87 super(in, columnNames, characterEncoding);
88 }
89 }