|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mmbase.util.CSVReader
public class CSVReader
Reads Comma Separated Values (CSV). Uses utf-8 as the default characterset. The csv should live somewhere in the webroot. The actual csv parsing is done with examplecode from O'Reilly's Java Cookbook written by Ian F. Darwin: "\"([^\"]+?)\",?|([^,]+),?|,".
| Field Summary | |
|---|---|
List<String> |
header
|
List<String> |
lines
|
Map<Integer,List<String>> |
rows
|
| Constructor Summary | |
|---|---|
CSVReader()
|
|
CSVReader(String filename)
|
|
CSVReader(String filename,
String delimiter)
|
|
CSVReader(String filename,
String delimiter,
String charset)
Constructor |
|
| Method Summary | |
|---|---|
String |
getDescription()
Description of the CSVReader, reports its configuration f.e. |
String |
getElement(int r,
int c)
Returns the element at the given row and column. |
Map<Integer,List<String>> |
getValues(String filename)
|
Map<Integer,List<String>> |
getValues(String filename,
String delimiter)
|
Map<Integer,List<String>> |
getValues(String filename,
String delimiter,
String charset)
Map to use in a taglib function. |
void |
readCSV(String filename,
String delimiter,
String charset)
Reads the contents of the CSV file. |
int |
size()
Returns the number of rows in the CVS file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public List<String> lines
public List<String> header
public Map<Integer,List<String>> rows
| Constructor Detail |
|---|
public CSVReader(String filename,
String delimiter,
String charset)
public CSVReader(String filename,
String delimiter)
public CSVReader(String filename)
public CSVReader()
| Method Detail |
|---|
public void readCSV(String filename,
String delimiter,
String charset)
filename - CSV filedelimiter - the komma or something else TODO!charset - by default UTF-8
public String getElement(int r,
int c)
r - the element rowc - the element column
public Map<Integer,List<String>> getValues(String filename)
public Map<Integer,List<String>> getValues(String filename,
String delimiter)
public Map<Integer,List<String>> getValues(String filename,
String delimiter,
String charset)
readCSV(java.lang.String, java.lang.String, java.lang.String) and returns csv-file rows.
filename - CSV file
public int size()
public String getDescription()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||