%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.turbine.util.CSVParser |
|
|
1 | package org.apache.turbine.util; |
|
2 | ||
3 | /* |
|
4 | * Copyright 2001-2005 The Apache Software Foundation. |
|
5 | * |
|
6 | * Licensed under the Apache License, Version 2.0 (the "License") |
|
7 | * you may not use this file except in compliance with the License. |
|
8 | * You may obtain a copy of the License at |
|
9 | * |
|
10 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
11 | * |
|
12 | * Unless required by applicable law or agreed to in writing, software |
|
13 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
15 | * See the License for the specific language governing permissions and |
|
16 | * limitations under the License. |
|
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 | 0 | super(in, null, class="keyword">null); |
62 | 0 | } |
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 | 0 | super(in, columnNames, null); |
74 | 0 | } |
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 | 0 | super(in, columnNames, characterEncoding); |
88 | 0 | } |
89 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |