|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.darwinsys.csv.CSVRE
public class CSVRE
Simple demo of CSV matching using Regular Expressions. Does NOT use the "CSV" class defined in the Java CookBook, but uses a regex pattern simplified from Chapter 7 of Mastering Regular Expressions (p. 205, first edn.) Example usage:
public static void main(String[] argv) throws IOException { System.out.println(CSV_PATTERN); new CSVRE().process(new BufferedReader(new InputStreamReader(System.in))); }
Field Summary | |
---|---|
static java.lang.String |
CSV_PATTERN
The rather involved pattern used to match CSV's consists of three alternations: the first matches a quoted field, the second unquoted, the third a null field. |
Constructor Summary | |
---|---|
CSVRE()
Construct a regex-based CSV parser. |
Method Summary | |
---|---|
static void |
main(java.lang.String[] argv)
|
java.util.List<java.lang.String> |
parse(java.lang.String line)
Parse one line. |
void |
process(java.io.BufferedReader in)
Process one file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String CSV_PATTERN
Constructor Detail |
---|
public CSVRE()
Method Detail |
---|
public static void main(java.lang.String[] argv) throws java.io.IOException
java.io.IOException
public void process(java.io.BufferedReader in) throws java.io.IOException
java.io.IOException
public java.util.List<java.lang.String> parse(java.lang.String line)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |