|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.csv4j.CSVParser
public class CSVParser
Parses CSV lines of text. Options are available to choose the
Notes: Line with trailing comma will result in an empty string field
Attempts to follow this suggestion from RFC4180:
Implementors should
"be conservative in what you do, be liberal in what you accept from others" (RFC 793)
when processing CSV files.
| Constructor Summary | |
|---|---|
CSVParser()
Constructor with default delimiter (,) and trimFields (true). |
|
CSVParser(char delimiter,
boolean trimFields)
Constructs the parser with specified options |
|
| Method Summary | |
|---|---|
long |
countFields(java.lang.String line)
Assumes this is one line of CSV text |
java.lang.String |
toJSon(java.lang.String line,
long lineNumber)
Assumes this is one line of CSV text |
java.util.List<java.lang.String> |
tokenize(java.lang.String line)
Assumes this is one line of CSV text |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CSVParser()
public CSVParser(char delimiter,
boolean trimFields)
delimiter - field separator character (e.g. comma, tab, vertical bar / pipe, space)trimFields - indicates if fields are to be trimmed or not| Method Detail |
|---|
public java.util.List<java.lang.String> tokenize(java.lang.String line)
throws ParseException
line - line of text to parse
ParseException - if
public long countFields(java.lang.String line)
throws ParseException
line - line of text to parse
ParseException - if
public java.lang.String toJSon(java.lang.String line,
long lineNumber)
throws ParseException
line - line of text to parse
ParseException - if
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||